trait ContextAwarePluginTrait (View source)

Provides a trait to add context-aware functionality to plugins.

Properties

protected ContextInterface[] $context

The data objects representing the context of this plugin.

protected bool internal $initializedContextConfig

Tracks whether the context has been initialized from configuration.

Methods

getContexts()

{@inheritdoc}

getContext($name)

{@inheritdoc}

setContext($name, ContextInterface $context)

{@inheritdoc}

getContextValues()

{@inheritdoc}

getContextValue($name)

{@inheritdoc}

setContextValue($name, $value)

{@inheritdoc}

getContextMapping()

{@inheritdoc}

setContextMapping(array $context_mapping)

{@inheritdoc}

getPluginDefinition()

{@inheritdoc}

validateContexts()

{@inheritdoc}

getCacheContexts()

{@inheritdoc}

getCacheTags()

{@inheritdoc}

getCacheMaxAge()

{@inheritdoc}

Details

getContexts()

{@inheritdoc}

ContextInterface getContext($name)

{@inheritdoc}

Parameters

$name

Return Value

ContextInterface

The context object.

setContext($name, ContextInterface $context)

{@inheritdoc}

Parameters

$name
ContextInterface $context

getContextValues()

{@inheritdoc}

getContextValue($name)

{@inheritdoc}

Parameters

$name

setContextValue($name, $value)

{@inheritdoc}

Parameters

$name
$value

getContextMapping()

{@inheritdoc}

setContextMapping(array $context_mapping)

{@inheritdoc}

Parameters

array $context_mapping

abstract protected getPluginDefinition()

{@inheritdoc}

ContextDefinitionInterface[] getContextDefinitions()

{@inheritdoc}

ContextDefinitionInterface getContextDefinition($name)

{@inheritdoc}

Parameters

$name

Return Value

ContextDefinitionInterface

validateContexts()

{@inheritdoc}

getCacheContexts()

{@inheritdoc}

getCacheTags()

{@inheritdoc}

getCacheMaxAge()

{@inheritdoc}