You are here

public function CertificateTemplate::loadPrintableEngine in Certificate 4.x

Load a printable engine.

Return value

\Drupal\entity_print\Plugin\PrintEngineBase

File

src/Entity/CertificateTemplate.php, line 121

Class

CertificateTemplate
Defines the Certificate Template entity class.

Namespace

Drupal\certificate\Entity

Code

public function loadPrintableEngine($configuration = []) {
  $engines = \Drupal::config('entity_print.settings')
    ->get('print_engines');
  if (empty($engines['pdf_engine'])) {
    return FALSE;
  }

  /* @var $pdf_eng \Drupal\entity_print\Plugin\PrintEngineBase */
  $pdf_eng = \Drupal::service('plugin.manager.entity_print.print_engine')
    ->createInstance($engines['pdf_engine'], $configuration);
  return $pdf_eng;
}