public CacheContextsManager::getLabels($include_calculated_cache_contexts = FALSE)
Provides an array of available cache context labels.
To be used in cache configuration forms.
bool $include_calculated_cache_contexts: Whether to also return calculated cache contexts. Default to FALSE.
array An array of available cache contexts and corresponding labels.
public function getLabels($include_calculated_cache_contexts = FALSE) { $with_labels = array(); foreach ($this->contexts as $context) { $service = $this->getService($context); if (!$include_calculated_cache_contexts && $service instanceof CalculatedCacheContextInterface) { continue; } $with_labels[$context] = $service->getLabel(); } return $with_labels; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Cache!Context!CacheContextsManager.php/function/CacheContextsManager::getLabels/8.1.x