function FactoryInterface::createInstance

Same name in other branches
  1. 9 core/lib/Drupal/Component/Plugin/Factory/FactoryInterface.php \Drupal\Component\Plugin\Factory\FactoryInterface::createInstance()
  2. 8.9.x core/lib/Drupal/Component/Plugin/Factory/FactoryInterface.php \Drupal\Component\Plugin\Factory\FactoryInterface::createInstance()
  3. 11.x core/lib/Drupal/Component/Plugin/Factory/FactoryInterface.php \Drupal\Component\Plugin\Factory\FactoryInterface::createInstance()

Creates a plugin instance based on the provided ID and configuration.

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.

1 method overrides FactoryInterface::createInstance()
DefaultFactory::createInstance in core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php
Creates a plugin instance based on the provided ID and configuration.

File

core/lib/Drupal/Component/Plugin/Factory/FactoryInterface.php, line 24

Class

FactoryInterface
Factory interface implemented by all plugin factories.

Namespace

Drupal\Component\Plugin\Factory

Code

public function createInstance($plugin_id, array $configuration = []);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.