public function ViewsTestCacheContext::getContext in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/tests/modules/views_test_data/src/Cache/ViewsTestCacheContext.php \Drupal\views_test_data\Cache\ViewsTestCacheContext::getContext()
- 9 core/modules/views/tests/modules/views_test_data/src/Cache/ViewsTestCacheContext.php \Drupal\views_test_data\Cache\ViewsTestCacheContext::getContext()
Returns the string representation of the cache context.
A cache context service's name is used as a token (placeholder) cache key, and is then replaced with the string returned by this method.
Return value
string The string representation of the cache context.
Overrides CacheContextInterface::getContext
File
- core/
modules/ views/ tests/ modules/ views_test_data/ src/ Cache/ ViewsTestCacheContext.php, line 25
Class
- ViewsTestCacheContext
- Test cache context which uses a dynamic context coming from state.
Namespace
Drupal\views_test_data\CacheCode
public function getContext() {
return \Drupal::state()
->get('views_test_cache_context', 'George');
}