/**
* Implements hook_theme_suggestions_HOOK_alter().
*/
function customer_feedback_theme_suggestions_form_element_label_alter(&$suggestions, $variables) {
if (isset($variables['element']['#id'])) {
$id = str_replace("-", "_", $variables['element']['#id']);
$suggestions[] = 'form_element_label' . '__' . $id;
}
}
After adding the above code, you can check the inspect element and see the theme file suggestion shown in the screenshot below. Here is the link to How to enable theme suggestions in Drupal 9?
Comments