function CacheContextsManager::getService
Same name in other branches
- 9 core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php \Drupal\Core\Cache\Context\CacheContextsManager::getService()
- 10 core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php \Drupal\Core\Cache\Context\CacheContextsManager::getService()
- 11.x core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php \Drupal\Core\Cache\Context\CacheContextsManager::getService()
Retrieves a cache context service from the container.
Parameters
string $context_id: The context ID, which together with the service ID prefix allows the corresponding cache context service to be retrieved.
Return value
\Drupal\Core\Cache\Context\CacheContextInterface The requested cache context service.
2 calls to CacheContextsManager::getService()
- CacheContextsManager::convertTokensToKeys in core/
lib/ Drupal/ Core/ Cache/ Context/ CacheContextsManager.php - Converts cache context tokens to cache keys.
- CacheContextsManager::getLabels in core/
lib/ Drupal/ Core/ Cache/ Context/ CacheContextsManager.php - Provides an array of available cache context labels.
File
-
core/
lib/ Drupal/ Core/ Cache/ Context/ CacheContextsManager.php, line 216
Class
- CacheContextsManager
- Converts cache context tokens into cache keys.
Namespace
Drupal\Core\Cache\ContextCode
protected function getService($context_id) {
return $this->container
->get('cache_context.' . $context_id);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.