You are here

public function AmpContext::routeIsNotAmp in Accelerated Mobile Pages (AMP) 8.3

Same name and namespace in other branches
  1. 8.2 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 168

Class

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

Namespace

Drupal\amp\Routing

Code

public function routeIsNotAmp(RouteMatchInterface $routeMatch) {

  // Is this an admin route?
  if ($this->adminContext
    ->isAdminRoute()) {
    return TRUE;
  }

  // Only path with amp in the query string or amp _wrapper_format, unless all pages are AMP.
  $everywhere = $this->configFactory
    ->get('amp.settings')
    ->get('amp_everywhere');
  $amp_wrapper_format = isset($_GET['_wrapper_format']) && $_GET['_wrapper_format'] == 'amp';
  $amp = isset($_GET['amp']);
  if (!$everywhere && !$amp_wrapper_format && !$amp) {
    return TRUE;
  }
  return FALSE;
}