Problem/Motivation
HTML classes should be usually added in templates instead of preprocess functions.
Proposed resolution
Move the HTML classes from the preprocess function to the template. The classes should be added in a template radios.html.twig file.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 3105583-10.patch | 1.14 KB | kostyashupenko |
Comments
Comment #2
hardik_patel_12 commentedKindly apply a new patch
Comment #3
hardik_patel_12 commentedComment #4
siddhant.bhosale commentedComment #5
siddhant.bhosale commentedThe patch looks good to me.
The class is being added from the radios.html.twig file.
Adding the screenshot where the added class on the radio is being highlighted.
Comment #6
siddhant.bhosale commentedComment #7
lauriiiComment #8
hardik_patel_12 commented@lauriii , can you help here to understand that, what is the issue in template , what needs to be improve for radio template.
Comment #9
lauriiiThere's nothing wrong with the patch except that it cannot be applied with the latest HEAD of core (due to conflict with #3105580: Move HTML classes from claro_preprocess_checkboxes to a template). Here's instructions for rerolling a patch: https://www.drupal.org/patch/reroll.
Comment #10
kostyashupenkoComment #11
hash6 commentedComment #12
hash6 commentedReviewed the patch and it adds the class correctly through the template.
Comment #13
hash6 commentedComment #14
andypostlooks a space is missing after comma
Comment #17
lauriiiCommitted cf8b8a4 and pushed to 9.0.x and 8.9.x. Thanks!
Comment #19
lauriiiI was supposed to address #14 on commit but I forgot to stage that change before committing. Committed that in a follow-up commit a473cdf.