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.
We have a template file named datetime.html.twig
in the system module, but it outputs a HTML5 <time>
tag, it should be renamed time.html.twig
.
This change also helps avoid confusion with '#type' => 'datetime'
which outputs a datetime form element.
Comment | File | Size | Author |
---|---|---|---|
#45 | interdiff.txt | 740 bytes | star-szr |
#45 | 2088365-45.patch | 2.93 KB | star-szr |
#42 | interdiff.txt | 801 bytes | CharuAg |
#42 | node-2088365-42.patch | 5.88 KB | CharuAg |
#40 | node-2088365-40.patch | 6.05 KB | bradklaver |
Comments
Comment #1
nod_tag
Comment #2
naveenvalechaTaking this one.
Comment #3
naveenvalechaAttached patch for this small change.
Comment #4
naveenvalechaPlease someone reroll the patch to update the documentation in the twig file.
Comment #6
undertext CreditAttribution: undertext commentedComment #7
undertext CreditAttribution: undertext commentedDoes this means that form element must be renamed to 'time' e.g
must be
Comment #8
nod_The form element is a different matter, time tag is not a form element at all. It's just for display.
For form types, see #2088383: Datetime FAPI DX.
Comment #9
star-szrTo make this change you will need to update drupal_common_theme() as well:
https://api.drupal.org/api/drupal/core%21includes%21theme.inc/function/d...
Usually the template name matches up with the theme hook name - so I would suggest updating the theme hook to 'time', so that it is rendered via '#theme' => 'time' rather than '#theme' => 'datetime'.
Comment #10
undertext CreditAttribution: undertext commentedComment #11
undertext CreditAttribution: undertext commentedComment #12
star-szrThat's great, thanks @undertext! Looks like this needs a reroll now.
We'll also need to update template_preprocess_datetime() to template_preprocess_time() - this is referenced in a @see in the Twig template.
The ideal result here will be a rerolled patch, an interdiff, and then a revised patch. The interdiff will show the differences between the rerolled patch and the revised patch (that updates the preprocess function).
Comment #13
grisendo CreditAttribution: grisendo commentedRe-rolled
Comment #14
grisendo CreditAttribution: grisendo commentedAnd now the template_preprocess_time change and interdiff
Comment #15
grisendo CreditAttribution: grisendo commentedComment #17
herom CreditAttribution: herom commentedthe patch is green, so... needs review.
Comment #18
grisendo CreditAttribution: grisendo commentedSorry, I forgot to set interdiff extension to .txt to avoid testing it :(
Comment #19
LinL CreditAttribution: LinL commentedPatch no longer applies.
Comment #20
sriharsha.uppuluri CreditAttribution: sriharsha.uppuluri commentedUploading the rerolled patch.
Comment #21
saltednut20: datetime.html_.twig-to-time.html_.twig-2088365-20.patch queued for re-testing.
Comment #22
star-szrThanks @sriharsha.uppuluri!
We need to rename template_preprocess_datetime() like in #14.
Comment #23
sriharsha.uppuluri CreditAttribution: sriharsha.uppuluri commentedThanks @Cottser
Renamed template_preprocess_datetime() like in #14.
Comment #25
visabhishek CreditAttribution: visabhishek commentedi am updating patch #20 based on #22 comments.
Comment #26
sriharsha.uppuluri CreditAttribution: sriharsha.uppuluri commentedComment #27
star-szrLooking good, one minor tweak needed then this should be ready to go:
While we're updating this it should follow our newer documentation standards for preprocess functions:
Preprocess function documentation standards
…and in particular it shouldn't refer to theme_time() because that doesn't exist :)
Comment #28
cs_shadow CreditAttribution: cs_shadow commentedChanged the patch in #25 to incorporate changes suggested in #27.
The doc block now looks like:
Comment #29
star-szrThanks @cs_shadow!
Interdiff next time, please! And "Preprocess" should be "Prepares" according to the documentation standards.
Comment #30
cs_shadow CreditAttribution: cs_shadow commentedChanged the patch as suggested in #29. Attaching interdiff.
Comment #32
cs_shadow CreditAttribution: cs_shadow commentedTrying to fix the errors in #28.
Comment #34
matthewmessmer CreditAttribution: matthewmessmer commentedI'm at the Austin core mentoring spring and I am going to reroll the latest patch.
Comment #35
matthewmessmer CreditAttribution: matthewmessmer commentedPatch #32 failed to apply due to renaming of core/modules/datetime/lib directory to core/modules/datetime/src.
Tried to create interdiff but could not reroll patch due to corrupt patch error when applying.
Recreated patch to match latest core version.
Comment #36
selfuntitled CreditAttribution: selfuntitled commentedAt Drupalcon Austin - just tested patch in #35. Applies cleanly, looks to remove all references to datetime.html.twig updated to reviewed and tested.
Comment #37
catchNot sure about this, while the HTML5 element is called 'time', the thing being formatted is a datetime (and the HTML5 spec allows a datetime attribute for that element). The whole point of the template is to allow for changing the markup, which could include using a different element.
Comment #38
nod_We do have
select.html.twig
,table.html.twig
,textarea.html.twig
,form.html.twig
,fieldset.html.twig
,details.html.twig
,html.html.twig
and alsoimage.html.twig
.( edit ) since template deal with HTML, it should be pretty clear to everyone it's the HTML meaning of time that is used.
Comment #39
joelpittet@catch, I was thinking along the same lines as you, it's such a blurry line here. Also very minor, I'd recommend making this change.
@_nod, I so wish we weren't so granular in the templates and let the templates live at a more component level or view mode level. That, or we may as well create a template for the whole html spec of tags. And the more granular the slower on the io and rendering... sorry I had to rant because I see these single tag templates with very little context and wonder how anybody builds a site in a reasonable amount of time with that level of templates. Like trying to build a fence and all you have is toothpicks. Oh and sorry because you may not be the right person to rant in the direction...
but seeing them listed out just made me go "argh".
This may need a small change record though?
Comment #40
bradklaver CreditAttribution: bradklaver commentedRe-rollling machostache 's patch in comment #35.
Comment #41
star-szrThanks @bradklaver!
This wasn't introduced by the reroll, but there's something broken. This also means we have little to no test coverage for the aggregator_summary_item theme hook (I hacked core to even get it to be used). The tests can probably be added in another issue, no need to hold this one up.
'#theme' should be changed to 'time' here and the attribute should remain as 'datetime'. See http://www.brucelawson.co.uk/2012/best-of-time/.
Comment #42
CharuAg CreditAttribution: CharuAg commentedAddressed comment 41.
Comment #43
star-szrIssue to add tests created: #2325501: Add test coverage for output of aggregator_summary_item theme hook
This needs a small change record then it can be RTBC.
Comment #44
star-szrWorking on the change record.
Comment #45
star-szr'#type' => 'datetime'
to the issue summary.RTBC!
Patch is smaller because I have this in my .gitconfig:
Comment #46
webchickGood catch.
Committed and pushed to 8.x. Thanks!