You are here

public function EventSubscriber::requireDompdf in Opigno certificate 3.x

Same name and namespace in other branches
  1. 8 src/EventSubscriber/EventSubscriber.php \Drupal\opigno_certificate\EventSubscriber\EventSubscriber::requireDompdf()

Loads dompdf.

File

src/EventSubscriber/EventSubscriber.php, line 50

Class

EventSubscriber
Class EventSubscriber.

Namespace

Drupal\opigno_certificate\EventSubscriber

Code

public function requireDompdf(GetResponseEvent $event) {
  $dompdf_autoloaders = [
    'libraries/dompdf/src/Autoloader.php',
    'profiles/opigno_lms/libraries/dompdf/src/Autoloader.php',
  ];
  foreach ($dompdf_autoloaders as $dompdf_autoloader) {
    if (file_exists($dompdf_autoloader)) {

      // Load dompdf for the entity_print.
      require_once $dompdf_autoloader;
      Autoloader::register();
      break;
    }
  }
}