LayoutBuilderEntityViewDisplay: provide method to get the section storage

Created on 2 May 2024, 8 months ago

Problem/Motivation

In LayoutBuilderEntityViewDisplay, the protected buildSections method is loading the section storage object. It calls another protected method, getContextsForEntity.

In contrib or custom modules altering Layout Builder display, it would be useful to be able to easily get the section storage object to get the sections. Because in hook_entity_view or hook_entity_view_alter, calling $display->getSections() does not take overrides into account.

Here is a MR on the UI Styles module https://git.drupalcode.org/project/ui_styles/-/merge_requests/52, where I had to copy the logic from LayoutBuilderEntityViewDisplay to get the section storage until some public method would be added.

Also, here is the link to a slack discussion where it as started: https://drupal.slack.com/archives/C0T77ULN9/p1714486953788219

Proposed resolution

Add a public method to easily get a section storage from a display entity.

Remaining tasks

- agree on solution
- implement it

API changes

Potentially new method in interface and classes implementing it.

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component
Layout builderΒ  β†’

Last updated 4 days ago

Created by

πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·

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

Comments & Activities

Production build 0.71.5 2024