- Issue created by @Grimreaper
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
Add a public method to easily get a section storage from a display entity.
- agree on solution
- implement it
Potentially new method in interface and classes implementing it.
Active
11.0 π₯
Last updated
Enhances developer experience.