public function MediaParentEntityCacheContext::getContext in Media Parent Entity Link 8
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
- src/
CacheContext/ MediaParentEntityCacheContext.php, line 32
Class
- MediaParentEntityCacheContext
- Class MediaParentEntityCacheContext.
Namespace
Drupal\media_parent_entity_link\CacheContextCode
public function getContext($parententity = NULL) {
return $parententity;
if ($parententity !== NULL) {
return $parententity
->bundle() . '-' . $parententity
->id();
}
}