ArchiverManager::createInstance

public ArchiverManager::createInstance($plugin_id, array $configuration = array())

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/Archiver/ArchiverManager.php, line 39

Class

ArchiverManager
Provides an Archiver plugin manager.

Namespace

Drupal\Core\Archiver

Code

public function createInstance($plugin_id, array $configuration = array()) {
  $plugin_definition = $this->getDefinition($plugin_id);
  $plugin_class = DefaultFactory::getPluginClass($plugin_id, $plugin_definition, 'Drupal\Core\Archiver\ArchiverInterface');
  return new $plugin_class($configuration['filepath']);
}
doc_Drupal
2016-10-29 08:44:43
Comments
Leave a Comment

Please login to continue.