You are here

protected function EntityPrintPluginManager::getPrintEngineSettings in Entity Print 8.2

Gets the entity config settings for this plugin.

Parameters

string $plugin_id: The plugin id.

Return value

array An array of Print engine settings for this plugin.

1 call to EntityPrintPluginManager::getPrintEngineSettings()
EntityPrintPluginManager::createInstance in src/Plugin/EntityPrintPluginManager.php
Creates a pre-configured instance of a plugin.

File

src/Plugin/EntityPrintPluginManager.php, line 154

Class

EntityPrintPluginManager
Entity print plugin manager.

Namespace

Drupal\entity_print\Plugin

Code

protected function getPrintEngineSettings($plugin_id) {

  /** @var \Drupal\entity_print\Entity\PrintEngineStorageInterface $storage */
  $storage = $this->entityTypeManager
    ->getStorage('print_engine');
  if (!($entity = $storage
    ->load($plugin_id))) {
    $entity = $storage
      ->create([
      'id' => $plugin_id,
    ]);
  }
  $configuration = $entity
    ->getSettings();
  $event = new GenericEvent(PrintEvents::CONFIGURATION_ALTER, [
    'configuration' => $configuration,
    'config' => $entity,
  ]);
  $this->dispatcher
    ->dispatch(PrintEvents::CONFIGURATION_ALTER, $event);
  $configuration = $event
    ->getArgument('configuration');
  return $configuration;
}