- 🇫🇮Finland joey-santiago
Had a look at this with @vermario.
We tried to understand how to do it and ended up with the idea that we should add a sorting function in the core/lib/Drupal/Core/Render/Element/Radios.php class.
Somehow the *template_preprocess_radios* function gets the options in $variables['children'], while we would have expected to have $variables['options'] there. We haven't fully understood how those children are built.
- 🇬🇧United Kingdom joachim
Make a form and give it a radios or checkboxes element.
Set some options in it which are in a silly order.
These form element types should have the ability to automatically sort their options, same as for select here: https://www.drupal.org/node/3068163 →
- 🇬🇧United Kingdom joachim
Look in Radios::processRadios().
You should sort $element before it's returned.