You are here

public function ContextAwarePluginBase::getContextMapping in Zircon Profile 8

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

Gets a mapping of the expected assignment names to their context names.

Return value

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

Overrides ContextAwarePluginInterface::getContextMapping

File

core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php, line 85
Contains \Drupal\Core\Plugin\ContextAwarePluginBase.

Class

ContextAwarePluginBase
Base class for plugins that are context aware.

Namespace

Drupal\Core\Plugin

Code

public function getContextMapping() {
  $configuration = $this instanceof ConfigurablePluginInterface ? $this
    ->getConfiguration() : $this->configuration;
  return isset($configuration['context_mapping']) ? $configuration['context_mapping'] : [];
}