You are here

function apigee_edge_theme_suggestions_apigee_entity in Apigee Edge 8

Implements hook_theme_suggestions_HOOK().

File

./apigee_edge.module, line 183
Copyright 2018 Google Inc.

Code

function apigee_edge_theme_suggestions_apigee_entity(array $variables) {
  $suggestions = [];

  /** @var \Drupal\apigee_edge\Entity\EdgeEntityInterface $entity */
  $entity = $variables['elements']['#entity'];
  $sanitized_view_mode = str_replace('.', '_', $variables['elements']['#view_mode']);
  if ($entity instanceof AppInterface) {
    $suggestions[] = 'apigee_entity__app';
    $suggestions[] = 'apigee_entity__app__' . $sanitized_view_mode;
  }
  $suggestions[] = 'apigee_entity__' . $entity
    ->getEntityTypeId();
  $suggestions[] = 'apigee_entity__' . $entity
    ->getEntityTypeId() . '__' . $sanitized_view_mode;
  return $suggestions;
}