From 4b552a482cef6906c79ab09ae1b2ee66cb9faecc Mon Sep 17 00:00:00 2001 From: Laryn Date: Tue, 27 Feb 2024 16:33:07 -0600 Subject: [PATCH] Issue #19: Description Toggle bugfix. Co-authored by: @olafgrabienski --- template.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/template.php b/template.php index b1081f35..2a3bd989 100644 --- a/template.php +++ b/template.php @@ -582,16 +582,17 @@ function gin_form_element($variables) { } // Add description toggle classes if settings call for them. $show_description_toggle = theme_get_setting('show_description_toggle', 'gin'); - $description['class'][] = 'description'; $help_icon_open = ''; $help_icon_close = ''; - if (!empty($element['#description']) && $show_description_toggle) { - backdrop_add_library('gin', 'gin_description_toggle'); - $attributes['class'][] = 'help-icon__description-container'; + if (!empty($element['#description'])) { $description_attributes['class'][] = 'description'; - $description_attributes['class'][] = 'visually-hidden'; - $help_icon_open = '
'; - $help_icon_close = '
'; + if ($show_description_toggle) { + backdrop_add_library('gin', 'gin_description_toggle'); + $attributes['class'][] = 'help-icon__description-container'; + $description_attributes['class'][] = 'visually-hidden'; + $help_icon_open = '
'; + $help_icon_close = '
'; + } } $output = '' . "\n";