More improvements to Submitted Formatter

Created on 5 March 2023, over 1 year ago
Updated 7 March 2023, over 1 year ago

Problem/Motivation

Follow on to ✨ Improvements to Submitted Formatter Fixed

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

✨ Feature request
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom AdamPS

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024