You are here

public function AmpContext::routeEntity in Accelerated Mobile Pages (AMP) 8.2

Same name and namespace in other branches
  1. 8.3 src/Routing/AmpContext.php \Drupal\amp\Routing\AmpContext::routeEntity()

Get the entity from the route.

Parameters

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

Return value

mixed Either an entity or FALSE.

1 call to AmpContext::routeEntity()
AmpContext::isAmpRoute in src/Routing/AmpContext.php
Determines whether the active route is an AMP route.

File

src/Routing/AmpContext.php, line 192

Class

AmpContext
Provides a helper class to determine whether the route is an amp one.

Namespace

Drupal\amp\Routing

Code

public function routeEntity(RouteMatchInterface $routeMatch) {
  if ($node = $routeMatch
    ->getParameter('node')) {
    return $node;
  }
  return FALSE;
}