You are here

public function EntityPrintPluginManager::createSelectedInstance in Entity Print 8.2

Gets currently selected plugin for this export type.

Parameters

string $export_type: The export type plugin id.

Return value

\Drupal\entity_print\Plugin\PrintEngineInterface The loaded print engine.

Overrides EntityPrintPluginManagerInterface::createSelectedInstance

File

src/Plugin/EntityPrintPluginManager.php, line 96

Class

EntityPrintPluginManager
Entity print plugin manager.

Namespace

Drupal\entity_print\Plugin

Code

public function createSelectedInstance($export_type) {
  $config = $this->configFactory
    ->get('entity_print.settings');
  $config_engine = 'print_engines.' . $export_type . '_engine';
  $plugin_id = $config
    ->get($config_engine);
  if (!$plugin_id) {
    throw new PrintEngineException(sprintf('Please configure a %s print engine.', $export_type));
  }
  return $this
    ->createInstance($plugin_id);
}