From c2b66d769adec4ae4fb1de3ff53f61cdbcb4cf34 Mon Sep 17 00:00:00 2001 From: Andreas Nielsen Date: Fri, 13 Sep 2024 15:15:00 +0200 Subject: [PATCH] Merged logic from duplicate novel_theme_suggestions_form_element_alter hook. --- web/themes/custom/novel/novel.theme | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/web/themes/custom/novel/novel.theme b/web/themes/custom/novel/novel.theme index 15c791a33..9ace1d83a 100644 --- a/web/themes/custom/novel/novel.theme +++ b/web/themes/custom/novel/novel.theme @@ -304,17 +304,6 @@ function novel_theme_suggestions_form_alter(array &$suggestions, array $variable } } -/** - * Implements hook_theme_suggestions_form_element_alter(). - */ -function novel_theme_suggestions_form_element_alter(array &$suggestions, array $variables): void { - $name = $variables['element']['#name'] ?? NULL; - - if ($name) { - $suggestions[] = "form_element__$name"; - } -} - /** * Implements hook_theme_suggestions_input_alter(). */ @@ -371,12 +360,16 @@ function novel_preprocess_views_view_unformatted(&$variables): void { * Implements hook_theme_suggestions_HOOK_alter() for form_element. */ function novel_theme_suggestions_form_element_alter(array &$suggestions, array $variables): void { + $name = $variables['element']['#name'] ?? NULL; + + if ($name) { + $suggestions[] = "form_element__$name"; + } + if (isset($variables['element']['#webform_element']) && $variables['element']['#type'] == 'checkbox') { - // Add the template suggestion. $suggestions[] = 'form_element__webform_checkbox'; } if (isset($variables['element']['#webform_element']) && $variables['element']['#type'] == 'radio') { - // Add the template suggestion. $suggestions[] = 'form_element__webform_radio'; } }