Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Move classes out of the preprocess functions and into the Twig templates.
Twig Templates Modified
core/modules/system/templates/time.html.twig
core/modules/datetime/templates/datetime-form.html.twig
core/modules/datetime/templates/datetime-wrapper.html.twig
Preprocess Functions Modified
core/includes/theme.inc: template_preprocess_time
core/modules/datetime/datetime.module: template_preprocess_datetime_form
core/modules/datetime/datetime.module: template_preprocess_datetime_wrapper
Comment | File | Size | Author |
---|---|---|---|
#27 | move_datetime_classes-2322287-27.patch | 3.1 KB | lauriii |
#27 | interdiff-2322287-25-27.txt | 571 bytes | lauriii |
#20 | interdiff-2322287-17-20.txt | 917 bytes | tuutti |
Comments
Comment #1
wheatpenny CreditAttribution: wheatpenny commentedComment #2
wheatpenny CreditAttribution: wheatpenny commentedComment #4
wheatpenny CreditAttribution: wheatpenny commentedComment #6
wheatpenny CreditAttribution: wheatpenny commentedComment #7
wheatpenny CreditAttribution: wheatpenny commentedComment #8
wheatpenny CreditAttribution: wheatpenny commentedThis patch needs to incorporate template_preprocess_datetime and datetime.html.twig. However, #2088365: Wrong name for datetime.html.twig should be time.html.twig is going to change the datetime.html.twig to time.html.twig. Therefore, I'm going to hold off with this issue until #2088365: Wrong name for datetime.html.twig should be time.html.twig is committed.
To do in the existing patch:
1. trailing comma on array of classes
2. rename "classes" variable to "title_classes" in datetime-wrapper.html.twig.
Comment #9
wheatpenny CreditAttribution: wheatpenny commentedComment #10
star-szr#2088365: Wrong name for datetime.html.twig should be time.html.twig is in!
I don't think all these sub-issues need to say 'Consensus Banana', I vote we keep it simple :)
Comment #11
davidhernandezUpdating the summary to include the time template and preprocess.
Comment #12
wheatpenny CreditAttribution: wheatpenny commentedUpdating tags list for Front End United sprint.
Comment #13
wheatpenny CreditAttribution: wheatpenny commentedTo do:
1. trailing comma on array of classes
2. rename "classes" variable to "title_classes" in datetime-wrapper.html.twig.
3. Move classes from template_preprocess_time to time.html.twig
Comment #14
davidhernandezComment #15
lauriiiRerolled the patch and did the changes proposed in #13.
Comment #16
RainbowArrayThis can just be:
Comment #17
lauriiiYeah!
Comment #18
lauriiiSending to testbot also!
Comment #19
star-szrLooking great overall!
I think we might need to keep this part so other modules can pass things in via the render element.
Can we do TRUE instead of 1 please? That'll be nicer when debugging from the template.
Comment #20
tuutti CreditAttribution: tuutti commentedComment #21
tuutti CreditAttribution: tuutti commentedComment #22
lauriiiLooks good but this one we don't need anymore! :)
Comment #23
tuutti CreditAttribution: tuutti commentedComment #24
star-szrCan we also explicitly set a FALSE for when #required is empty? Otherwise it won't show up in Twig context for debugging. There may be one or two other banana patches that could use this type of change.
Other than that looks great. Thanks @tuutti!
Comment #25
tuutti CreditAttribution: tuutti commentedComment #26
star-szrOops. And since we're adding the new 'required' variable we should document it in the Twig template :) Something like "A flag indicating whether the field is required or not" maybe.
Comment #27
lauriiiComment #28
davidhernandezI manually tested and everything looks good.
Comment #29
alexpottCommitted 145778c and pushed to 8.0.x. Thanks!