You are here

function civicrm_entity_theme_suggestions_civicrm_entity_alter in CiviCRM Entity 8.3

Implements hook_theme_suggestions_HOOK_alter().

File

./civicrm_entity.module, line 275
Module file for the CiviCRM Entity module.

Code

function civicrm_entity_theme_suggestions_civicrm_entity_alter(array &$suggestions, array $variables) {
  $view_mode = $variables['elements']['#view_mode'];
  $hook = $variables['theme_hook_original'];

  // Add a suggestion based on the entity type.
  if ($entity_type = _civicrm_entity_get_entity_type_from_elements($variables['elements'])) {
    $suggestions[] = $hook . '__' . $entity_type;

    // Add a suggestion based on the view mode.
    $suggestions[] = $hook . '__' . $entity_type . '__' . $view_mode;
  }
}