Drupal 8  8.0.2
PageDisplayVariantSelectionEvent Class Reference
Inheritance diagram for PageDisplayVariantSelectionEvent:

Public Member Functions

 __construct ($plugin_id, RouteMatchInterface $route_match)
 
 setPluginId ($plugin_id)
 
 getPluginId ()
 
 setPluginConfiguration (array $configuration)
 
 getPluginConfiguration ()
 
 getRouteMatch ()
 
 getContexts ()
 
 setContexts (array $contexts)
 
- Public Member Functions inherited from RefinableCacheableDependencyInterface
 addCacheContexts (array $cache_contexts)
 
 addCacheTags (array $cache_tags)
 
 mergeCacheMaxAge ($max_age)
 
 addCacheableDependency ($other_object)
 
- Public Member Functions inherited from CacheableDependencyInterface
 getCacheContexts ()
 
 getCacheTags ()
 
 getCacheMaxAge ()
 

Protected Attributes

 $pluginId
 
 $pluginConfiguration = []
 
 $routeMatch
 
 $contexts = []
 

Detailed Description

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()
See Also
::SELECT_PAGE_DISPLAY_VARIANT

Constructor & Destructor Documentation

__construct (   $plugin_id,
RouteMatchInterface  $route_match 
)

Constructs the page display variant plugin selection event.

Parameters
stringThe ID of the page display variant plugin to use by default.
\Drupal\Core\Routing\RouteMatchInterface$route_matchThe current route match, for context.

References Drupal\routeMatch().

Here is the call graph for this function:

Member Function Documentation

getContexts ( )

Gets the contexts that were set during event dispatch.

Returns
[] An array of set contexts, keyed by context name.
getPluginConfiguration ( )

Get the configuration for the selected page display variant.

Returns
array
getPluginId ( )

The selected page display variant plugin ID.

Returns
string;
getRouteMatch ( )

Gets the current route match.

Returns
The current route match, for context.
setContexts ( array  $contexts)

Sets the contexts to be passed to the page display variant.

Parameters
\Drupal\Component\Plugin\Context\ContextInterface[]$contexts An array of contexts, keyed by context name.
Returns
$this

Referenced by TestPageDisplayVariantSubscriber\onSelectPageDisplayVariant().

Here is the caller graph for this function:

setPluginConfiguration ( array  $configuration)

Set the configuration for the selected page display variant.

Parameters
array$configurationThe configuration for the selected page display variant.
Returns
$this

Referenced by TestPageDisplayVariantSubscriber\onSelectPageDisplayVariant().

Here is the caller graph for this function:

setPluginId (   $plugin_id)

The selected page display variant plugin ID.

Parameters
string$plugin_idThe ID of the page display variant plugin to use.
Returns
$this

Referenced by BlockPageDisplayVariantSubscriber\onSelectPageDisplayVariant(), and TestPageDisplayVariantSubscriber\onSelectPageDisplayVariant().

Here is the caller graph for this function:


The documentation for this class was generated from the following file: