You are here

protected function LocalTaskUsageController::getEntityFromRouteMatch in Entity Usage 8

Same name and namespace in other branches
  1. 8.4 src/Controller/LocalTaskUsageController.php \Drupal\entity_usage\Controller\LocalTaskUsageController::getEntityFromRouteMatch()
  2. 8.2 src/Controller/LocalTaskUsageController.php \Drupal\entity_usage\Controller\LocalTaskUsageController::getEntityFromRouteMatch()
  3. 8.3 src/Controller/LocalTaskUsageController.php \Drupal\entity_usage\Controller\LocalTaskUsageController::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 LocalTaskUsageController::getEntityFromRouteMatch()
LocalTaskUsageController::checkAccessLocalTask in src/Controller/LocalTaskUsageController.php
Checks access based on whether the user can view the current entity.
LocalTaskUsageController::getTitleLocalTask in src/Controller/LocalTaskUsageController.php
Title page callback.
LocalTaskUsageController::listUsageLocalTask in src/Controller/LocalTaskUsageController.php
Lists the usage of a given entity.

File

src/Controller/LocalTaskUsageController.php, line 64

Class

LocalTaskUsageController
Controller for our local tasks.

Namespace

Drupal\entity_usage\Controller

Code

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