8.5.x ContextAwarePluginBase.php ContextAwarePluginBase::createContextFromConfiguration(array $context_configuration)
8.5.x ContextAwarePluginBase.php ContextAwarePluginBase::createContextFromConfiguration(array $context_configuration)
8.0.x ContextAwarePluginBase.php ContextAwarePluginBase::createContextFromConfiguration(array $context_configuration)
8.0.x ContextAwarePluginBase.php ContextAwarePluginBase::createContextFromConfiguration(array $context_configuration)
8.1.x ContextAwarePluginBase.php ContextAwarePluginBase::createContextFromConfiguration(array $context_configuration)
8.1.x ContextAwarePluginBase.php ContextAwarePluginBase::createContextFromConfiguration(array $context_configuration)
8.2.x ContextAwarePluginBase.php ContextAwarePluginBase::createContextFromConfiguration(array $context_configuration)
8.2.x ContextAwarePluginBase.php ContextAwarePluginBase::createContextFromConfiguration(array $context_configuration)
8.3.x ContextAwarePluginBase.php ContextAwarePluginBase::createContextFromConfiguration(array $context_configuration)
8.3.x ContextAwarePluginBase.php ContextAwarePluginBase::createContextFromConfiguration(array $context_configuration)
8.4.x ContextAwarePluginBase.php ContextAwarePluginBase::createContextFromConfiguration(array $context_configuration)
8.4.x ContextAwarePluginBase.php ContextAwarePluginBase::createContextFromConfiguration(array $context_configuration)
8.6.x ContextAwarePluginBase.php ContextAwarePluginBase::createContextFromConfiguration(array $context_configuration)
8.6.x ContextAwarePluginBase.php ContextAwarePluginBase::createContextFromConfiguration(array $context_configuration)

Creates context objects from any context mappings in configuration.

Parameters

array $context_configuration: An associative array of context names and values.

Return value

\Drupal\Component\Plugin\Context\ContextInterface[] An array of context objects.

1 call to ContextAwarePluginBase::createContextFromConfiguration()
1 method overrides ContextAwarePluginBase::createContextFromConfiguration()

File

core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php, line 56

Class

ContextAwarePluginBase
Base class for plugins that are context aware.

Namespace

Drupal\Component\Plugin

Code

protected function createContextFromConfiguration(array $context_configuration) {
  $contexts = [];
  foreach ($context_configuration as $key => $value) {
    $context_definition = $this
      ->getContextDefinition($key);
    $contexts[$key] = new Context($context_definition, $value);
  }
  return $contexts;
}