function layout_builder_theme_suggestions_field_alter

Implements hook_theme_suggestions_HOOK_alter().

File

core/modules/layout_builder/layout_builder.module, line 409

Code

function layout_builder_theme_suggestions_field_alter(&$suggestions, array $variables) {
  $element = $variables['element'];
  if (isset($element['#third_party_settings']['layout_builder']['view_mode'])) {
    // See system_theme_suggestions_field().
    $suggestions[] = 'field__' . $element['#entity_type'] . '__' . $element['#field_name'] . '__' . $element['#bundle'] . '__' . $element['#third_party_settings']['layout_builder']['view_mode'];
  }
  return $suggestions;
}

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