You are here

public function ContextHandlerInterface::applyContextMapping in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Plugin/Context/ContextHandlerInterface.php \Drupal\Core\Plugin\Context\ContextHandlerInterface::applyContextMapping()

Prepares a plugin for evaluation.

Parameters

\Drupal\Core\Plugin\ContextAwarePluginInterface $plugin: A plugin about to be evaluated.

\Drupal\Core\Plugin\Context\ContextInterface[] $contexts: An array of contexts to set on the plugin. They will only be set if they match the plugin's context definitions.

array $mappings: (optional) A mapping of the expected assignment names to their context names. For example, if one of the $contexts is named 'current_user', but the plugin expects a context named 'user', then this map would contain 'user' => 'current_user'.

Throws

\Drupal\Component\Plugin\Exception\ContextException Thrown when a context assignment was not satisfied.

1 method overrides ContextHandlerInterface::applyContextMapping()
ContextHandler::applyContextMapping in core/lib/Drupal/Core/Plugin/Context/ContextHandler.php
Prepares a plugin for evaluation.

File

core/lib/Drupal/Core/Plugin/Context/ContextHandlerInterface.php, line 83
Contains \Drupal\Core\Plugin\Context\ContextHandlerInterface.

Class

ContextHandlerInterface
Provides an interface for handling sets of contexts.

Namespace

Drupal\Core\Plugin\Context

Code

public function applyContextMapping(ContextAwarePluginInterface $plugin, $contexts, $mappings = array());