Problem/Motivation
Follow on to #3344232: Improvements to Submitted Formatter
Field wrappers
The field wrappers don't match the markup from Drupal Core. The existing code inserts one field inside another which is quite confusing, and puts the wrappers in the wrong place.
Template variables
- Some themes such as Olivero use classes such as
node__meta. Hence the submitted template would have<footer class="{{ entity_type }}__meta">. author_attributesnot working as it isn't initialisednode.html.twigrefers toauthor_picturehowevercomment.html.twigandsubmitted.html.twigususer_picture
Reply-to Formatter
WSOD if comment is somehow missing subject or author.
Proposed resolution
Field wrappers
Instead of nesting the fields, use hook_entity_view_alter() to create a new structure $build['submitted'] that contains each of the fields separately, with their normal field wrappers. Need to forces the fields to display inline output, copying the approach used already in core with #is_inline variable.
Template variables
- Pass an extra variable
entity_type. - Initialise the
author_attributesvariable. - Pass an extra variable
author_picturethat duplicatesuser_picture.
Reply-to Formatter
Guard against missing fields.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | manage_display.improve-submitted.3346096-4.patch | 13.11 KB | adamps |
| #4 | manage_display.improve-submitted.3346096-interdiff-2-4.txt | 2.85 KB | adamps |
| #2 | manage_display.improve-submitted.3346096-2.patch | 10.03 KB | adamps |
Comments
Comment #2
adamps commentedComment #4
adamps commentedComment #5
adamps commentedComment #7
adamps commented