Skip to content

Instantly share code, notes, and snippets.

@larowlan
Created February 19, 2018 01:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save larowlan/1af01e63b600bcf6fa41816dba7e0975 to your computer and use it in GitHub Desktop.
Save larowlan/1af01e63b600bcf6fa41816dba7e0975 to your computer and use it in GitHub Desktop.
<?php
class SomeClass extends BlockBase {
/**
* {@inheritdoc}
*/
public function getCacheContexts() {
$contexts = parent::getCacheContexts();
// Tell Drupal that this block should be cached per-user.
$contexts[] = 'user';
return $contexts;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment