You are here

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

See if this route uses the AMP theme.

Parameters

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

Return value

boolean

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

File

src/Routing/AmpContext.php, line 124

Class

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

Namespace

Drupal\amp\Routing

Code

public function routeThemeisAmp(RouteMatchInterface $routeMatch) {
  $current_theme = $this->themeManager
    ->getActiveTheme($routeMatch)
    ->getName();
  $amp_theme = $this->configFactory
    ->get('amp.theme')
    ->get('amptheme');
  if ($amp_theme == $current_theme) {
    return TRUE;
  }
  return FALSE;
}