public function EntityPrintPluginManager::createInstance in Entity Print 8
Same name and namespace in other branches
- 8.2 src/Plugin/EntityPrintPluginManager.php \Drupal\entity_print\Plugin\EntityPrintPluginManager::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
File
- src/
Plugin/ EntityPrintPluginManager.php, line 43
Class
Namespace
Drupal\entity_print\PluginCode
public function createInstance($plugin_id, array $configuration = []) {
$configuration = array_merge($this
->getPdfEngineSettings($plugin_id), $configuration);
/** @var \Drupal\entity_print\Plugin\PdfEngineInterface $class */
$definition = $this
->getDefinition($plugin_id);
$class = $definition['class'];
// Throw an exception if someone tries to use a plugin that doesn't have all
// of its dependencies met.
if (!$class::dependenciesAvailable()) {
throw new PdfEngineException(sprintf('Missing dependencies. %s', $class::getInstallationInstructions()));
}
return parent::createInstance($plugin_id, $configuration);
}