function ThemeSuggestionHooks::formElement

Same name and namespace in other branches
  1. main core/themes/admin/src/Hook/ThemeSuggestionHooks.php \Drupal\admin\Hook\ThemeSuggestionHooks::formElement()

Implements hook_theme_suggestions_HOOK_alter() for form_element.

Attributes

#[Hook('theme_suggestions_form_element_alter')]

File

core/themes/admin/src/Hook/ThemeSuggestionHooks.php, line 50

Class

ThemeSuggestionHooks
Provides theme suggestion hook implementations.

Namespace

Drupal\admin\Hook

Code

public function formElement(array &$suggestions, array $variables) : void {
  if (!empty($variables['element']['#type'])) {
    $suggestions[] = 'form_element__' . $variables['element']['#type'];
  }
}

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