function EntityDebugController::getEntityFromRouteMatch

Same name in other branches
  1. 4.x src/Controller/EntityDebugController.php \Drupal\devel\Controller\EntityDebugController::getEntityFromRouteMatch()
  2. 5.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;
}