class ViewsTestCacheContext
Same name in other branches
- 8.9.x core/modules/views/tests/modules/views_test_data/src/Cache/ViewsTestCacheContext.php \Drupal\views_test_data\Cache\ViewsTestCacheContext
- 10 core/modules/views/tests/modules/views_test_data/src/Cache/ViewsTestCacheContext.php \Drupal\views_test_data\Cache\ViewsTestCacheContext
- 11.x core/modules/views/tests/modules/views_test_data/src/Cache/ViewsTestCacheContext.php \Drupal\views_test_data\Cache\ViewsTestCacheContext
Test cache context which uses a dynamic context coming from state.
Cache context ID: 'views_test_cache_context'.
Hierarchy
- class \Drupal\views_test_data\Cache\ViewsTestCacheContext implements \Drupal\Core\Cache\Context\CacheContextInterface
Expanded class hierarchy of ViewsTestCacheContext
1 string reference to 'ViewsTestCacheContext'
- views_test_data.services.yml in core/
modules/ views/ tests/ modules/ views_test_data/ views_test_data.services.yml - core/modules/views/tests/modules/views_test_data/views_test_data.services.yml
1 service uses ViewsTestCacheContext
- cache_context.views_test_cache_context in core/
modules/ views/ tests/ modules/ views_test_data/ views_test_data.services.yml - Drupal\views_test_data\Cache\ViewsTestCacheContext
File
-
core/
modules/ views/ tests/ modules/ views_test_data/ src/ Cache/ ViewsTestCacheContext.php, line 13
Namespace
Drupal\views_test_data\CacheView source
class ViewsTestCacheContext implements CacheContextInterface {
/**
* {@inheritdoc}
*/
public static function getLabel() {
return t('Views test cache context');
}
/**
* {@inheritdoc}
*/
public function getContext() {
return \Drupal::state()->get('views_test_cache_context', 'George');
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata() {
return new CacheableMetadata();
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
ViewsTestCacheContext::getCacheableMetadata | public | function | Overrides CacheContextInterface::getCacheableMetadata | |
ViewsTestCacheContext::getContext | public | function | Overrides CacheContextInterface::getContext | |
ViewsTestCacheContext::getLabel | public static | function | Overrides CacheContextInterface::getLabel |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.