Problem/Motivation
HTML classes should be usually added in templates instead of preprocess functions. Also, Drupal core modules shouldn't include represantional HTML classes.
Proposed resolution
Move the HTML classes from the preprocess function to the template. The classes should be added in a template in Classy / Stable but not in the module.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #33 | 3105015-nr-bot.txt | 144 bytes | needs-review-queue-bot |
| #24 | 3105015-24.patch | 3.65 KB | swatichouhan012 |
| #21 | 3105015-21.patch | 1.76 KB | prabha1997 |
| #21 | interdiff_19-21.txt | 1.69 KB | prabha1997 |
| #8 | After_apply_patch.png | 41.95 KB | ankush_03 |
Comments
Comment #2
lauriiiComment #3
hardik_patel_12 commentedKindly review a patch
Comment #4
hardik_patel_12 commentedComment #6
hardik_patel_12 commentedKindly follow a new patch
Comment #7
hardik_patel_12 commentedComment #8
ankush_03Patch #6 Working fine, Also attached image for the same.
Comment #10
prabha1997 commentedI am working on this issue
Comment #11
prabha1997 commentedI created a patch for this issue
Comment #12
prabha1997 commentedComment #13
dhirendra.mishra commented@prabha, Your patch does not contain the changes from preprocess which was there in #6 comment.
Let me upload the latest patch along with Inter-diff from #12.
Comment #14
dhirendra.mishra commentedComment #16
dhirendra.mishra commentedComment #18
prabha1997 commentedComment #19
prabha1997 commentedwe can add classes directly using class attribute
Comment #21
prabha1997 commentedComment #22
krzysztof domański1. Re #19 @prabha1997 We should leave the variable attributes in templates.
Then we can use attributes.classes in child templates, for example:
2. Patch from #14 looks good. There are more templates to change. See
core/modules/image/templates/image-widget.html.twigandcore/themes/claro/templates/content-edit/image-widget.html.twig. One note,div {{there should be no spaces here.Comment #23
krzysztof domańskiNow I noticed that we should not change the templates in the module. #22.2 is not a good idea then.
Comment #24
swatichouhan012 commentedWe can use classes from parent template. I am attaching patch here please review.
Comment #26
swatichouhan012 commentedComment #33
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.