Problem/Motivation
We wanted to add styling to specific types of fields. for instance all checkboxes. We noticed there was no class for this but there was a javascript class for this. Furthermore, the Classy template does provide this class and it seemed odd that this was not a standard class.
This issue should appear in any Drupal installation that uses a custom theme or any theme that does not override the form-element.html.twig template, for instance, the stark template.
Proposed resolution
The class 'form-type-' ~ type|clean_class, should be added to the template in the system module and possibly in the stable theme.
This could be done by adding 'form-type-' ~ type|clean_class, to the classes variable in the form-element.html.twig templates.
Remaining tasks
1. The patch is ready for review.
2. This patch will need to be reviewed.

| Comment | File | Size | Author |
|---|---|---|---|
| #19 | 3051692-nr-bot.txt | 167 bytes | needs-review-queue-bot |
| #13 | system-module-template-3051692-13.patch | 1.71 KB | ramya balasubramanian |
| #11 | Screen Shot 2020-06-11 at 6.00.10 PM.png | 775.93 KB | ramya balasubramanian |
| #2 | add_class-3051692-1.patch | 1.15 KB | hikkypo |
Issue fork drupal-3051692
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3051692-form-type
changes, plain diff MR !12578
Comments
Comment #2
hikkypo commentedComment #5
ramya balasubramanian commentedSince the patch was already added, I have added a manual test to see the results.
Comment #6
ramya balasubramanian commentedMoving this to Needs review, since the manual test is passed.
Comment #7
Rkumar commentedThen it must be in all the core themes. As I can see changes are missing in claro. Please check it for all.
Comment #8
Rkumar commentedComment #9
ramya balasubramanian commentedComment #10
ramya balasubramanian commentedHi @Rkumar,
I have checked your patch. And this class was added inside the form-element.html.twig. This class was already added in Umami, Bartik, seven, classy which contains form-element.html.twig file. But in claro theme, the file (form-element.html.twig and the folder (form) was not there. So I am not sure whether we need to add this in the claro theme as well since the file was not there. Please see the below
screenshots.
Comment #11
ramya balasubramanian commentedUploaded the screenshot again.
Comment #12
ramya balasubramanian commentedHi @Rkumar,
Thanks. This class was missing in stable 9 themes. So I have updated the patch, please have a look.
Comment #13
ramya balasubramanian commentedHi,
Please ignore the above patch. That patch is incorrect. Please have a look at this patch. Sorry for the inconvenience.
Comment #19
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #20
rassoni commentedRe-roll against D10.
Comment #21
kpoornima commentedReviewed patch #20 getting "form-type". Please refer screen shot
Comment #22
catchThis looks like an oversight in the original classes, but tagging for front end framework manager review since I'm not sure how it sits with classy/stable deprecations etc.
Comment #24
larowlanThe problem we might have here is that technically stable templates are supposed to be stable, i.e. have no changes.
Comment #25
ckrinaWe discussed this with @bnjmnm and we agree this extra class would be useful. But as @larowlan says this shouldn't be a change to Stable, only to the module itself. So moving to Needs work to remove this from the last patch.
Comment #26
kostyashupenkoComment #27
smustgrave commentedConfirmed patch #26 is only applying to module. With such a small change wonder if it needs a change record?
Comment #29
kostyashupenkoPatch still applies cleanly
random test failure
Comment #32
mstrelan commentedChecked starterkit_theme and it already has this class too. Created an MR, hiding patches.
Comment #34
smustgrave commentedSeems straight forward then.
Comment #37
nod_Committed faec142 and pushed to 11.x. Thanks!