You are here

public function ConditionManager::createInstance in Drupal 10

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

Creates a pre-configured instance of a plugin.

Parameters

string $plugin_id: The ID of the plugin being instantiated.

array $configuration: An array of configuration relevant to the plugin instance.

Return value

object A fully configured plugin instance.

Throws

\Drupal\Component\Plugin\Exception\PluginException If the instance cannot be created, such as if the ID is invalid.

Overrides PluginManagerBase::createInstance

File

core/lib/Drupal/Core/Condition/ConditionManager.php, line 58

Class

ConditionManager
A plugin manager for condition plugins.

Namespace

Drupal\Core\Condition

Code

public function createInstance($plugin_id, array $configuration = []) {
  $plugin = $this
    ->getFactory()
    ->createInstance($plugin_id, $configuration);
  return $plugin
    ->setExecutableManager($this);
}