Skip to content

Commit 9117e5f

Browse files
authored
[4.0] Update buttons.php layout to latest Bootstrap 5 markup, also added LEGEND markup (#32367)
* Update buttons.php Updated layout file according to Bootstrap 5 new markup * the `active` class no longer required for the label * the `<input>` is no longer inside the `<label>` element * the new markup requires no `bootstrap.Button` plugin functionality anymore Details on the updated markup https://getbootstrap.com/docs/5.0/components/button-group/#checkbox-and-radio-button-groups * Update buttons.php Regarding #32367 (comment) * Update buttons.php LoL typo * Update buttons.php Changes: * Reverting to previous as explained [here](#32367 (comment)), now `class="btn-group btn-group-yesno"` is necessary to create a switcher with `type="Radio"` field with the `buttons` layout * added `<legend>` as mentioned [here](#32367 (comment)) * both `.switcher__legend` and the new `radio__legend` additional styling is irrelevant since both elements use `.visually-hidden`, the `.switcher__legend` is now redundant * Update buttons.php
1 parent 5bacf58 commit 9117e5f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

layouts/joomla/form/field/radio/buttons.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@
7979
}
8080
?>
8181
<fieldset id="<?php echo $id; ?>" >
82+
<legend class="visually-hidden">
83+
<?php echo $label; ?>
84+
</legend>
8285
<div <?php echo implode(' ', $attribs); ?>>
8386
<?php foreach ($options as $i => $option) : ?>
8487
<?php
@@ -104,7 +107,6 @@
104107
$optionClass = trim($optionClass . ' ' . $disabled);
105108
}
106109
$checked = ((string) $option->value === $value) ? 'checked="checked"' : '';
107-
$optionClass .= $checked ? ' active' : '';
108110

109111
// Initialize some JavaScript option attributes.
110112
$onclick = !empty($option->onclick) ? 'onclick="' . $option->onclick . '"' : '';
@@ -116,8 +118,8 @@
116118
<?php if ($required) : ?>
117119
<?php $attributes[] = 'required'; ?>
118120
<?php endif; ?>
121+
<input<?php echo $classToggle; ?> type="radio" id="<?php echo $oid; ?>" name="<?php echo $name; ?>" value="<?php echo $ovalue; ?>" <?php echo implode(' ', $attributes); ?>>
119122
<label for="<?php echo $oid; ?>" class="<?php echo trim($optionClass . ' ' . $style); ?>">
120-
<input<?php echo $classToggle; ?> type="radio" id="<?php echo $oid; ?>" name="<?php echo $name; ?>" value="<?php echo $ovalue; ?>" <?php echo implode(' ', $attributes); ?>>
121123
<?php echo $option->text; ?>
122124
</label>
123125
<?php endforeach; ?>

0 commit comments

Comments
 (0)