You are here

protected function EntityDebugController::getEntityFromRouteMatch in Devel 8

Same name and namespace in other branches
  1. 8.3 src/Controller/EntityDebugController.php \Drupal\devel\Controller\EntityDebugController::getEntityFromRouteMatch()
  2. 8.2 src/Controller/EntityDebugController.php \Drupal\devel\Controller\EntityDebugController::getEntityFromRouteMatch()
  3. 4.x src/Controller/EntityDebugController.php \Drupal\devel\Controller\EntityDebugController::getEntityFromRouteMatch()

Retrieves entity from route match.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The route match.

Return value

\Drupal\Core\Entity\EntityInterface|null The entity object as determined from the passed-in route match.

3 calls to EntityDebugController::getEntityFromRouteMatch()
EntityDebugController::entityLoad in src/Controller/EntityDebugController.php
Returns the loaded structure of the current entity.
EntityDebugController::entityRender in src/Controller/EntityDebugController.php
Returns the render structure of the current entity.
EntityDebugController::entityTypeDefinition in src/Controller/EntityDebugController.php
Returns the entity type definition of the current entity.

File

src/Controller/EntityDebugController.php, line 137

Class

EntityDebugController
Controller for devel entity debug.

Namespace

Drupal\devel\Controller

Code

protected function getEntityFromRouteMatch(RouteMatchInterface $route_match) {
  $parameter_name = $route_match
    ->getRouteObject()
    ->getOption('_devel_entity_type_id');
  $entity = $route_match
    ->getParameter($parameter_name);
  return $entity;
}