Problem/Motivation

We are mostly testing Entity view display with theme overriding and cleaning entity templates (node.html.twig, user.html.twig, media.html.twig...)

However, when we test with Olivero, we notice this:

  • content._display_builder is not properly printed
  • we still have the placeholders for author_name and others hardcoded print like that

Proposed resolution

Like what we have done for Views and Page Layout, add a specific (and dynamic!) theme registry entry for display edited by Display Builder.

With a minimalist entity.html.twig:

{{ content }}

it will also be the opportunity to tidy and simplify EntityViewDisplayTrait::displayBuilderBuildMultiple()

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pdureau created an issue. See original summary.

pdureau’s picture

Let's try a fresh new install, so with olivero as the only front theme.

Article full page

Setup:

  1. I create an article
  2. I activate Display builder from /admin/structure/types/manage/article/display
  3. I build the display suing the olivero teaser component: /admin/structure/types/manage/article/display/default/display-builder
  4. I save

We pass through Olivero's node.html.twig

Results:

  • ❌ My comment field is never displayed, because of olivero's node.html.twig
  • ⚠️ I see the hardcoded metdata from olivero's node.html.twig. We can't consider this something to fix or something to keep.

Article teaser

We pass through Olivero's node--teaser.html.twig which a presenter template calling olivero:teaser component

Before activating display builder in /admin/structure/types/manage/article/display/teaser :

  • ❌ The rendering of the teaser of broken maybe bcause of the current implementation of EntityViewDisplayTrait::displayBuilderBuildMultiple()

After building /admin/structure/types/manage/article/display/teaser/display-builder

  • ❌ The rendering of the teaser is still broken
  • ❌ fixing it will not be enough because we are stuck with the rigid layout

conclusion

So, they are 2 things to fix in this issue:

  • Don't break displays when display builder is not activated
  • Skip wrapper template when display builder is activated

pdureau’s picture

Status: Active » Needs work

MR opened. Work in progress

pdureau’s picture

It will also be the opportunity to make Display Builder priority upon Layoutt Builder when both are activated, and maybe merge the 2 implementation of ::buildMultiple()

pdureau’s picture

Let's try a fresh new install, so with olivero as the only front theme.

Article full page

Setup:

  1. I create an article
  2. I activate Display builder from /admin/structure/types/manage/article/display
  3. I build the display using the olivero teaser component: /admin/structure/types/manage/article/display/default/display-builder
  4. I save

✅ We don't pass through Olivero's node.html.twig anymore

Results:

  • ⚠️ My comment field is still not displayed, but it is not because of olivero's node.html.twig finally. We have the same issue with any theme, with or wthout display builder. It may be related to my environement.
  • ✅ I don't see the hardcoded metdata from olivero's node.html.twig.

Article teaser

Before activating display builder in /admin/structure/types/manage/article/display/teaser , we pass through Olivero's node--teaser.html.twig which a presenter template calling olivero:teaser component:

  • ⚠️ The rendering of the teaser of broken is still broken: the blocks logic in the template is not properly executed. For example, the image field is not going to the image block and is staying in the content block. It doesn't seem related to our work.

After building /admin/structure/types/manage/article/display/teaser/display-builder

  • ✅ The rendering of the teaser is not broken anymore
  • ✅ We are not stuck with the rigid layout

conclusion

So, they are 2 things to fix in this issue:

  • ⚠️ Don't break displays when display builder is not activated
  • ✅ Skip wrapper template when display builder is activated

And also:

  • ✅ Make Display Builder priority upon Layout Builder when both are activated
  • ✅ Merge the 2 implementations of ::buildMultiple()
  • ✅ it is still OK with Overrides
pdureau’s picture

Assigned: pdureau » mogtofu33
Status: Needs work » Needs review

mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
Status: Needs review » Fixed
pdureau’s picture

Status: Fixed » Closed (fixed)