You are here

protected function EntityPrintPluginManager::getPdfEngineSettings in Entity Print 8

Gets the entity config settings for this plugin.

Parameters

string $plugin_id: The plugin id.

Return value

array An array of PDF engine settings for this plugin.

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

File

src/Plugin/EntityPrintPluginManager.php, line 68

Class

EntityPrintPluginManager

Namespace

Drupal\entity_print\Plugin

Code

protected function getPdfEngineSettings($plugin_id) {

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