You are here

protected function PreviewLinkController::resolveEntity in Preview Link 8

Resolve the entity being previewed.

Return value

\Drupal\Core\Entity\EntityInterface The entity.

1 call to PreviewLinkController::resolveEntity()
PreviewLinkController::preview in src/Controller/PreviewLinkController.php
Preview any entity with the default view mode.

File

src/Controller/PreviewLinkController.php, line 39

Class

PreviewLinkController
Preview link controller to view any entity.

Namespace

Drupal\preview_link\Controller

Code

protected function resolveEntity() {
  $route_match = \Drupal::routeMatch();
  $preview_link_paramater = $route_match
    ->getRouteObject()
    ->getOption('preview_link.entity_type_id');
  return $route_match
    ->getParameter($preview_link_paramater);
}