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

  1. Some themes such as Olivero use classes such as node__meta. Hence the submitted template would have <footer class="{{ entity_type }}__meta">.
  2. author_attributes not working as it isn't initialised
  3. node.html.twig refers to author_picture however comment.html.twig and submitted.html.twig us user_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

  1. Pass an extra variable entity_type.
  2. Initialise the author_attributes variable.
  3. Pass an extra variable author_picture that duplicates user_picture.

Reply-to Formatter

Guard against missing fields.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

AdamPS created an issue. See original summary.

adamps’s picture

Status: Active » Needs review
StatusFileSize
new10.03 KB

Status: Needs review » Needs work

The last submitted patch, 2: manage_display.improve-submitted.3346096-2.patch, failed testing. View results

adamps’s picture

Status: Needs work » Needs review
StatusFileSize
new2.85 KB
adamps’s picture

  • AdamPS committed a56d1cf5 on 3.x
    Issue #3346096 by AdamPS: More improvements to Submitted Formatter
    
adamps’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.