public function AmpContext::routeIsNotAmp in Accelerated Mobile Pages (AMP) 8.2
Same name and namespace in other branches
- 8.3 src/Routing/AmpContext.php \Drupal\amp\Routing\AmpContext::routeIsNotAmp()
Not an AMP route?
Check off things that indicate this can't be an AMP route. TRUE means it can't be an AMP route, FALSE means we can't tell.
Parameters
\Drupal\Core\Routing\RouteMatchInterface $route_match: The route match.
Return value
boolean
1 call to AmpContext::routeIsNotAmp()
- AmpContext::isAmpRoute in src/
Routing/ AmpContext.php - Determines whether the active route is an AMP route.
File
- src/
Routing/ AmpContext.php, line 166
Class
- AmpContext
- Provides a helper class to determine whether the route is an amp one.
Namespace
Drupal\amp\RoutingCode
public function routeIsNotAmp(RouteMatchInterface $routeMatch) {
$route = $routeMatch
->getRouteObject();
if (!$route instanceof Route) {
return TRUE;
}
// Is this an admin route?
if ($this->adminContext
->isAdminRoute()) {
return TRUE;
}
// We only path with amp in the query string, unless all pages are AMP.
$everywhere = $this->configFactory
->get('amp.settings')
->get('amp_everywhere');
if (!$everywhere && !isset($_GET['amp'])) {
return TRUE;
}
return FALSE;
}