Skip to content

Commit

Permalink
Issue #19: Description Toggle bugfix.
Browse files Browse the repository at this point in the history
Co-authored by: @olafgrabienski
  • Loading branch information
laryn authored Feb 27, 2024
1 parent 90916e1 commit 4b552a4
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions template.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<div class="help-icon">';
$help_icon_close = '<button class="help-icon__description-toggle"></button></div>';
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 = '<div class="help-icon">';
$help_icon_close = '<button class="help-icon__description-toggle"></button></div>';
}
}
$output = '<div' . backdrop_attributes($attributes) . '>' . "\n";

Expand Down

0 comments on commit 4b552a4

Please sign in to comment.