User tests: Successful: Unsuccessful:
Allow to add class attribute and additional attributes to select.groupedlist htmlhelper.
This allows the optgroup the same attributes like select.options
create a HTMLHelper::_('select.groupedlist'); which includes group.class and group.attr entries.
Example:
$data = [];
$data[0]['items'][''] = Text::_('JSELECT');
$data['group1'] = [
'label' => 'I'm group 1',
'items' => [
'value1' => 'text1',
'value2' => 'text2',
]
'class' => 'niceclass',
'attr' => 'data-additional="information"'
];
echo \Joomla\CMS\HTML\HTMLHelper::_('select.groupedlist', $data, 'testname' , [
'group.items' => 'items',
'group.label' => 'label',
'group.class' => 'class',
]);
<select name="testname">
<option value="" selected="selected">Auswählen</option>
<optgroup label="I am group 1">
<option value="value1">text1</option>
<option value="value2">text2</option>
</optgroup>
</select><select name="testname">
<option value="" selected="selected">Auswählen</option>
<optgroup label="I am group 1" class="niceclass" data-additional="information">
<option value="value1">text1</option>
<option value="value2">text2</option>
</optgroup>
</select>Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Libraries |
| Labels |
Added:
PR-6.1-dev
|
||
I like it @dgrammatiko but I think we are not there yet https://caniuse.com/selectlist (all read and behind feature flag) since 2022.
Anyway we would need another approach for this kind of customization, maybe finally a layout for the htmlhelper.select.xxx but I think we will not be the first supporting this ;-)
I have tested this item ✅ successfully on 5dd1b89
I tested this issue, and it was tested successfully.
I have tested this item ✅ successfully on 5dd1b89
There are two faults in the example data:
I have tested this item ✅ successfully on 5dd1b89
@HLeithner although this is nice enhancement it falls quite sort for the upcoming (already available in the chromium supported browsers)
<select>changes:Docs: whatwg/html#10548
Video: https://www.youtube.com/shorts/6yFm0BLI2hk