You are here

function eck_theme_suggestions_eck_entity in Entity Construction Kit (ECK) 8

Implements hook_theme_suggestions_HOOK().

File

./eck.module, line 260
Contains hook implementations.

Code

function eck_theme_suggestions_eck_entity(array $variables) {

  /** @var \Drupal\eck\Entity\EckEntity $entity */
  $entity = $variables['elements']['#eck_entity'];
  $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
  $suggestions[] = 'eck_entity__' . $sanitized_view_mode;
  $suggestions[] = 'eck_entity__' . $entity
    ->getEntityTypeId();
  $suggestions[] = 'eck_entity__' . $entity
    ->getEntityTypeId() . '__' . $sanitized_view_mode;
  $suggestions[] = 'eck_entity__' . $entity
    ->getEntityTypeId() . '__' . $entity
    ->bundle();
  $suggestions[] = 'eck_entity__' . $entity
    ->getEntityTypeId() . '__' . $entity
    ->bundle() . '__' . $sanitized_view_mode;
  $suggestions[] = 'eck_entity__' . $entity
    ->id();
  $suggestions[] = 'eck_entity__' . $entity
    ->id() . '__' . $sanitized_view_mode;
  return $suggestions;
}