You are here

public function ConditionManager::createInstance in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Condition/ConditionManager.php \Drupal\Core\Condition\ConditionManager::createInstance()

Override of Drupal\Component\Plugin\PluginManagerBase::createInstance().

Overrides PluginManagerBase::createInstance

File

core/lib/Drupal/Core/Condition/ConditionManager.php, line 54
Contains \Drupal\Core\Condition\ConditionManager.

Class

ConditionManager
A plugin manager for condition plugins.

Namespace

Drupal\Core\Condition

Code

public function createInstance($plugin_id, array $configuration = array()) {
  $plugin = $this
    ->getFactory()
    ->createInstance($plugin_id, $configuration);

  // If we receive any context values via config set it into the plugin.
  if (!empty($configuration['context'])) {
    foreach ($configuration['context'] as $name => $context) {
      $plugin
        ->setContextValue($name, $context);
    }
  }
  return $plugin
    ->setExecutableManager($this);
}