ViewsTestCacheContext.php in Drupal 8
File
core/modules/views/tests/modules/views_test_data/src/Cache/ViewsTestCacheContext.php
View source
<?php
namespace Drupal\views_test_data\Cache;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Cache\Context\CacheContextInterface;
class ViewsTestCacheContext implements CacheContextInterface {
public static function getLabel() {
return t('Views test cache context');
}
public function getContext() {
return \Drupal::state()
->get('views_test_cache_context', 'George');
}
public function getCacheableMetadata() {
return new CacheableMetadata();
}
}