You are here

function field_group_theme_suggestions_alter in Field Group 8

Same name and namespace in other branches
  1. 8.3 field_group.module \field_group_theme_suggestions_alter()

Implements hook_theme_suggestions_alter().

Parameters

array $suggestions:

array $variables:

$hook:

File

./field_group.module, line 81
Allows administrators to attach custom fields to fieldable types.

Code

function field_group_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {
  switch ($hook) {
    case 'horizontal_tabs':
    case 'field_group_accordion_item':
    case 'field_group_accordion':
    case 'field_group_html_element':
      $element = $variables['element'];
      $name = $element['#group_name'];
      $entity_type = $element['#entity_type'];
      $bundle = $element['#bundle'];
      $wrapper = '';
      if (isset($element['#wrapper_element'])) {
        $wrapper = $element['#wrapper_element'];
        $suggestions[] = $hook . '__' . $wrapper;
      }
      $suggestions[] = $hook . '__' . $entity_type;
      $suggestions[] = $hook . '__' . $bundle;
      $suggestions[] = $hook . '__' . $name;
      if ($wrapper) {
        $suggestions[] = $hook . '__' . $entity_type . '__' . $wrapper;
      }
      $suggestions[] = $hook . '__' . $entity_type . '__' . $bundle;
      $suggestions[] = $hook . '__' . $entity_type . '__' . $name;
      if ($wrapper) {
        $suggestions[] = $hook . '__' . $entity_type . '__' . $bundle . '__' . $wrapper;
      }
      $suggestions[] = $hook . '__' . $entity_type . '__' . $bundle . '__' . $name;
      break;
  }
}