Theme registry entry for Entity view display

Created on 25 August 2025, 12 days ago

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()

📌 Task
Status

Active

Version

1.0

Component

display_builder_entity_view

Created by

🇫🇷France pdureau Paris

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

Merge Requests

Comments & Activities

  • Issue created by @pdureau
  • 🇫🇷France pdureau Paris

    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
  • 🇫🇷France pdureau Paris

    MR opened. Work in progress

  • 🇫🇷France pdureau Paris

    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()

  • 🇫🇷France pdureau Paris

    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 olivero's node.html.twig
    • ✅ 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

    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()
Production build 0.71.5 2024