Skip to content

Commit 4b552a4

Browse files
authored
Issue #19: Description Toggle bugfix.
Co-authored by: @olafgrabienski
1 parent 90916e1 commit 4b552a4

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

template.php

+8-7
Original file line numberDiff line numberDiff line change
@@ -582,16 +582,17 @@ function gin_form_element($variables) {
582582
}
583583
// Add description toggle classes if settings call for them.
584584
$show_description_toggle = theme_get_setting('show_description_toggle', 'gin');
585-
$description['class'][] = 'description';
586585
$help_icon_open = '';
587586
$help_icon_close = '';
588-
if (!empty($element['#description']) && $show_description_toggle) {
589-
backdrop_add_library('gin', 'gin_description_toggle');
590-
$attributes['class'][] = 'help-icon__description-container';
587+
if (!empty($element['#description'])) {
591588
$description_attributes['class'][] = 'description';
592-
$description_attributes['class'][] = 'visually-hidden';
593-
$help_icon_open = '<div class="help-icon">';
594-
$help_icon_close = '<button class="help-icon__description-toggle"></button></div>';
589+
if ($show_description_toggle) {
590+
backdrop_add_library('gin', 'gin_description_toggle');
591+
$attributes['class'][] = 'help-icon__description-container';
592+
$description_attributes['class'][] = 'visually-hidden';
593+
$help_icon_open = '<div class="help-icon">';
594+
$help_icon_close = '<button class="help-icon__description-toggle"></button></div>';
595+
}
595596
}
596597
$output = '<div' . backdrop_attributes($attributes) . '>' . "\n";
597598

0 commit comments

Comments
 (0)