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";