You are here

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

See if this entity is AMP.

Parameters

mixed $entity: An entity

Return value

boolean

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

File

src/Routing/AmpContext.php, line 207

Class

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

Namespace

Drupal\amp\Routing

Code

public function entityIsAmp($entity) {
  if ($entity instanceof \Drupal\node\NodeInterface) {
    $type = $entity
      ->getType();
    return $this->entityTypeInfo
      ->isAmpEnabledType($type);
  }
  return FALSE;
}