function system_theme_suggestions_field

Same name in other branches
  1. 9 core/modules/system/system.module \system_theme_suggestions_field()
  2. 10 core/modules/system/system.module \system_theme_suggestions_field()
  3. 11.x core/modules/system/system.module \system_theme_suggestions_field()

Implements hook_theme_suggestions_HOOK().

File

core/modules/system/system.module, line 370

Code

function system_theme_suggestions_field(array $variables) {
    $suggestions = [];
    $element = $variables['element'];
    $suggestions[] = 'field__' . $element['#field_type'];
    $suggestions[] = 'field__' . $element['#field_name'];
    $suggestions[] = 'field__' . $element['#entity_type'] . '__' . $element['#bundle'];
    $suggestions[] = 'field__' . $element['#entity_type'] . '__' . $element['#field_name'];
    $suggestions[] = 'field__' . $element['#entity_type'] . '__' . $element['#field_name'] . '__' . $element['#bundle'];
    return $suggestions;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.