8.5.x ContextAwarePluginBase.php ContextAwarePluginBase::getContextMapping()
8.0.x ContextAwarePluginBase.php ContextAwarePluginBase::getContextMapping()
8.1.x ContextAwarePluginBase.php ContextAwarePluginBase::getContextMapping()
8.2.x ContextAwarePluginBase.php ContextAwarePluginBase::getContextMapping()
8.3.x ContextAwarePluginBase.php ContextAwarePluginBase::getContextMapping()
8.4.x ContextAwarePluginBase.php ContextAwarePluginBase::getContextMapping()
8.6.x ContextAwarePluginBase.php 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 80

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'] : [];
}