class MediaParentEntityCacheContext in Media Parent Entity Link 8
Class MediaParentEntityCacheContext.
Hierarchy
- class \Drupal\media_parent_entity_link\CacheContext\MediaParentEntityCacheContext implements CacheContextInterface
Expanded class hierarchy of MediaParentEntityCacheContext
1 string reference to 'MediaParentEntityCacheContext'
1 service uses MediaParentEntityCacheContext
File
- src/
CacheContext/ MediaParentEntityCacheContext.php, line 12
Namespace
Drupal\media_parent_entity_link\CacheContextView source
class MediaParentEntityCacheContext implements CacheContextInterface {
/**
* Constructs a new MediaParentEntityCacheContext object.
*/
public function __construct() {
}
/**
* {@inheritdoc}
*/
public static function getLabel() {
\Drupal::messenger()
->addMessage('Lable of cache context');
}
/**
* {@inheritdoc}
*/
public function getContext($parententity = NULL) {
return $parententity;
if ($parententity !== NULL) {
return $parententity
->bundle() . '-' . $parententity
->id();
}
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata() {
return new CacheableMetadata();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MediaParentEntityCacheContext:: |
public | function |
Gets the cacheability metadata for the context. Overrides CacheContextInterface:: |
|
MediaParentEntityCacheContext:: |
public | function |
Returns the string representation of the cache context. Overrides CacheContextInterface:: |
|
MediaParentEntityCacheContext:: |
public static | function |
Returns the label of the cache context. Overrides CacheContextInterface:: |
|
MediaParentEntityCacheContext:: |
public | function | Constructs a new MediaParentEntityCacheContext object. |