You are here

public function FactoryInterface::createInstance in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/Plugin/Factory/FactoryInterface.php \Drupal\Component\Plugin\Factory\FactoryInterface::createInstance()
  2. 9 core/lib/Drupal/Component/Plugin/Factory/FactoryInterface.php \Drupal\Component\Plugin\Factory\FactoryInterface::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.

5 methods override FactoryInterface::createInstance()
DefaultFactory::createInstance in core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php
Creates a pre-configured instance of a plugin.
LayoutPluginManagerInterface::createInstance in core/lib/Drupal/Core/Layout/LayoutPluginManagerInterface.php
MenuLinkManager::createInstance in core/lib/Drupal/Core/Menu/MenuLinkManager.php
Returns a pre-configured menu link plugin instance.
PluginManagerBase::createInstance in core/lib/Drupal/Component/Plugin/PluginManagerBase.php
Creates a pre-configured instance of a plugin.
TypedDataManagerInterface::createInstance in core/lib/Drupal/Core/TypedData/TypedDataManagerInterface.php
Instantiates a typed data object.

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 = []);