PageDisplayVariantSelectionEvent
class PageDisplayVariantSelectionEvent extends Event implements RefinableCacheableDependencyInterface (View source)
Event fired when rendering main content, to select a page display variant.
Subscribers of this event can call the following setters to pass additional information along to the selected variant:
- self::setPluginConfiguration()
- self::setContexts()
- self::addCacheableDependency()
Traits
Trait for \Drupal\Core\Cache\RefinableCacheableDependencyInterface.
Trait for \Drupal\Core\Cache\CacheableDependencyInterface.
Properties
| protected string[] | $cacheContexts | Cache contexts. |
from CacheableDependencyTrait |
| protected string[] | $cacheTags | Cache tags. |
from CacheableDependencyTrait |
| protected int | $cacheMaxAge | Cache max-age. |
from CacheableDependencyTrait |
| protected string | $pluginId | The selected page display variant plugin ID. |
|
| protected array | $pluginConfiguration | The configuration for the selected page display variant. |
|
| protected RouteMatchInterface | $routeMatch | The current route match. |
|
| protected ContextInterface[] | $contexts | An array of collected contexts to pass to the page display variant. |
Methods
Sets cacheability; useful for value object constructors.
Constructs the page display variant plugin selection event.
The selected page display variant plugin ID.
The selected page display variant plugin ID.
Set the configuration for the selected page display variant.
Get the configuration for the selected page display variant.
Gets the current route match.
Gets the contexts that were set during event dispatch.
Sets the contexts to be passed to the page display variant.
Details
protected $this
setCacheability(CacheableDependencyInterface $cacheability)
Sets cacheability; useful for value object constructors.
getCacheTags()
{@inheritdoc}
getCacheContexts()
{@inheritdoc}
getCacheMaxAge()
{@inheritdoc}
addCacheableDependency($other_object)
{@inheritdoc}
addCacheContexts(array $cache_contexts)
{@inheritdoc}
addCacheTags(array $cache_tags)
{@inheritdoc}
mergeCacheMaxAge($max_age)
{@inheritdoc}
__construct(string $plugin_id, RouteMatchInterface $route_match)
Constructs the page display variant plugin selection event.
$this
setPluginId(string $plugin_id)
The selected page display variant plugin ID.
string
getPluginId()
The selected page display variant plugin ID.
$this
setPluginConfiguration(array $configuration)
Set the configuration for the selected page display variant.
array
getPluginConfiguration()
Get the configuration for the selected page display variant.
RouteMatchInterface
getRouteMatch()
Gets the current route match.
ContextInterface[]
getContexts()
Gets the contexts that were set during event dispatch.
$this
setContexts(array $contexts)
Sets the contexts to be passed to the page display variant.