You are here

protected function PrintEngineExceptionSubscriber::getEntity in Entity Print 8.2

Gets a generic entity from the route data if it exists.

Return value

bool|\Drupal\Core\Entity\EntityInterface The entity or FALSE if it does not exist.

1 call to PrintEngineExceptionSubscriber::getEntity()
PrintEngineExceptionSubscriber::handleException in src/EventSubscriber/PrintEngineExceptionSubscriber.php
Handles print exceptions.

File

src/EventSubscriber/PrintEngineExceptionSubscriber.php, line 78

Class

PrintEngineExceptionSubscriber
Exception event subscriber.

Namespace

Drupal\entity_print\EventSubscriber

Code

protected function getEntity() {
  $entity_type = $this->routeMatch
    ->getParameter('entity_type');
  $entity_id = $this->routeMatch
    ->getParameter('entity_id');
  return $entity_type && $entity_id ? $this->entityTypeManager
    ->getStorage($entity_type)
    ->load($entity_id) : FALSE;
}