You are here

public function ContextAwarePluginBase::getContextMapping in Drupal 8

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 = PluginHelper::isConfigurable($this) ? $this
    ->getConfiguration() : $this->configuration;
  return isset($configuration['context_mapping']) ? $configuration['context_mapping'] : [];
}