function LayoutBuilderHooks::themeSuggestionsFieldAlter
Implements hook_theme_suggestions_HOOK_alter().
File
-
core/
modules/ layout_builder/ src/ Hook/ LayoutBuilderHooks.php, line 391
Class
- LayoutBuilderHooks
- Hook implementations for layout_builder.
Namespace
Drupal\layout_builder\HookCode
public function themeSuggestionsFieldAlter(&$suggestions, array $variables) : void {
$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'];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.