public function PageEventVariables::addCacheContext in Hook Event Dispatcher 8.2
Same name and namespace in other branches
- 3.x modules/preprocess_event_dispatcher/src/Variables/PageEventVariables.php \Drupal\preprocess_event_dispatcher\Variables\PageEventVariables::addCacheContext()
Add a cache context to the page template.
Parameters
string $context: A cache context such as 'url.path'.
File
- modules/
preprocess_event_dispatcher/ src/ Variables/ PageEventVariables.php, line 106
Class
- PageEventVariables
- Class PageEventVariables.
Namespace
Drupal\preprocess_event_dispatcher\VariablesCode
public function addCacheContext(string $context) : void {
$this->variables['#cache']['contexts'][] = $context;
}