You are here

public function PluginCollectionItemBase::createContainedPluginInstance in Plugin 8.2

Creates a plugin instance.

Parameters

string $plugin_id:

mixed[] $plugin_configuration:

Return value

\Drupal\Component\Plugin\PluginInspectionInterface|null A plugin instance or NULL if there was no plugin ID.

Overrides PluginCollectionItemInterface::createContainedPluginInstance

Deprecated

Deprecated as of 8.x-2.0 and scheduled for removal before 8.x-3.0. Use static::getPluginType()->getPluginManager()->createInstance() instead.

File

src/Plugin/Field/FieldType/PluginCollectionItemBase.php, line 47

Class

PluginCollectionItemBase
Provides a base for plugin collection field items.

Namespace

Drupal\plugin\Plugin\Field\FieldType

Code

public function createContainedPluginInstance($plugin_id, array $plugin_configuration = []) {
  $plugin_instance = $this
    ->getPluginType()
    ->getPluginManager()
    ->createInstance($plugin_id, $plugin_configuration);
  $this
    ->validatePluginInstance($plugin_instance);
  return $plugin_instance;
}