3 namespace Drupal\views_test_data\Cache;
5 use Drupal\Core\Cache\CacheableMetadata;
6 use Drupal\Core\Cache\Context\CacheContextInterface;
9 * Test cache context which uses a dynamic context coming from state.
11 * Cache context ID: 'views_test_cache_context'.
13 class ViewsTestCacheContext implements CacheContextInterface {
18 public static function getLabel() {
19 return t('Views test cache context');
25 public function getContext() {
26 return \Drupal::state()->get('views_test_cache_context', 'George');
32 public function getCacheableMetadata() {
33 return new CacheableMetadata();