You are here

public function TokenDevelController::entityTokens in Token 8

Prints the loaded structure of the current entity.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: A RouteMatch object.

Return value

array Array of page elements to render.

File

src/Controller/TokenDevelController.php, line 51

Class

TokenDevelController
Devel integration for tokens.

Namespace

Drupal\token\Controller

Code

public function entityTokens(RouteMatchInterface $route_match) {
  $output = [];
  $parameter_name = $route_match
    ->getRouteObject()
    ->getOption('_token_entity_type_id');
  $entity = $route_match
    ->getParameter($parameter_name);
  if ($entity && $entity instanceof EntityInterface) {
    $output = $this
      ->renderTokenTree($entity);
  }
  return $output;
}