You are here

public function EntityTypeInfo::isAmpEnabledType in Accelerated Mobile Pages (AMP) 8.3

Same name and namespace in other branches
  1. 8 src/EntityTypeInfo.php \Drupal\amp\EntityTypeInfo::isAmpEnabledType()
  2. 8.2 src/EntityTypeInfo.php \Drupal\amp\EntityTypeInfo::isAmpEnabledType()

Checks if AMP is enabled for this bundle.

Parameters

string $node_type: The node type to check whether AMP is enabled or not.

Return value

bool TRUE if AMP is enabled for this bundle. FALSE otherwise.

File

src/EntityTypeInfo.php, line 51

Class

EntityTypeInfo
Service class for retrieving and manipulating entity type information.

Namespace

Drupal\amp

Code

public function isAmpEnabledType($node_type) {
  $amp_display = $this->entityTypeManager
    ->getStorage('entity_view_display')
    ->load('node.' . $node_type . '.amp');
  if ($amp_display && $amp_display
    ->status()) {
    return TRUE;
  }
  return FALSE;
}