function ConditionManager::createInstance
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Condition/ConditionManager.php \Drupal\Core\Condition\ConditionManager::createInstance()
- 10 core/lib/Drupal/Core/Condition/ConditionManager.php \Drupal\Core\Condition\ConditionManager::createInstance()
- 11.x core/lib/Drupal/Core/Condition/ConditionManager.php \Drupal\Core\Condition\ConditionManager::createInstance()
Overrides PluginManagerBase::createInstance
File
-
core/
lib/ Drupal/ Core/ Condition/ ConditionManager.php, line 58
Class
- ConditionManager
- A plugin manager for condition plugins.
Namespace
Drupal\Core\ConditionCode
public function createInstance($plugin_id, array $configuration = []) {
$plugin = $this->getFactory()
->createInstance($plugin_id, $configuration);
// If we receive any context values via config set it into the plugin.
if (!empty($configuration['context'])) {
@trigger_error('Passing context values to plugins via configuration is deprecated in drupal:9.1.0 and will be removed before drupal:10.0.0. Instead, call ::setContextValue() on the plugin itself. See https://www.drupal.org/node/3120980', E_USER_DEPRECATED);
foreach ($configuration['context'] as $name => $context) {
$plugin->setContextValue($name, $context);
}
}
return $plugin->setExecutableManager($this);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.