Optimise Layout builder EntityViewDisplay

Created on 31 January 2024, 11 months ago
Updated 3 February 2024, 11 months ago

Problem/Motivation

- Layout builder replaces the EntityViewDisplay class with LayoutBuilderEntityViewDisplay for all fieldable entities. It does not check if the entity actually uses LayoutBuilder. This triggers a possibly unnecessary load of all available sections.
- Fields places in the field UI are also always rendered; even when the entity uses layout builder and those fields are discarded later.

Steps to reproduce

  • Add fields to a node in viewmode Full, using the field UI.
  • Override node full with layout builder
  • In the node layout builder override, add an inline block to the node layout

The inline block will be rendered using LayoutBuilderEntityViewDisplay::buildSections() too, even if layout builder is not enabled for that Inline Block

The added fields will also be processed, and discarded later.

Proposed resolution

  • Check if an entity actually uses layout builder before using LayoutBuilderEntityViewDisplay::buildSections() to render it.
  • Only render field UI as a fallback.

Questions

Why do we support the fallback which renders the placed fields from the field UI if there are no sections?
And if we need to keep supporting it, why cant we edit the field widgets anymore once layout builder override is enabled?

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
Layout builderΒ  β†’

Last updated 4 days ago

Created by

πŸ‡§πŸ‡ͺBelgium StryKaizer Belgium

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024