You are here

public function ImageToolkitOperationManager::createInstance in Drupal 10

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

1 call to ImageToolkitOperationManager::createInstance()
ImageToolkitOperationManager::getToolkitOperation in core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationManager.php
Returns a toolkit operation plugin instance.

File

core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationManager.php, line 109

Class

ImageToolkitOperationManager
Manages toolkit operation plugins.

Namespace

Drupal\Core\ImageToolkit

Code

public function createInstance($plugin_id, array $configuration = [], ImageToolkitInterface $toolkit = NULL) {
  $plugin_definition = $this
    ->getDefinition($plugin_id);
  $plugin_class = DefaultFactory::getPluginClass($plugin_id, $plugin_definition);
  return new $plugin_class($configuration, $plugin_id, $plugin_definition, $toolkit, $this->logger);
}