You are here

public function AmpContext::routeIsAmp 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::routeIsAmp()

Definitely an AMP route?

Some routes must be AMP.

Parameters

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

Return value

boolean

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

File

src/Routing/AmpContext.php, line 143

Class

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

Namespace

Drupal\amp\Routing

Code

public function routeIsAmp(RouteMatchInterface $routeMatch) {
  $route = $routeMatch
    ->getRouteObject();
  if (!$route instanceof Route) {
    return FALSE;
  }

  // Check if the globally-defined AMP status has been changed to TRUE (it
  // is FALSE by default).
  if ($route
    ->getOption('_amp_route')) {
    return TRUE;
  }
}