Problem/Motivation
Subclass \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay::getRuntimeSections and load the sections from the field added in #2941806: Create an ER field to store reference to the chosen layout on the content entity.
Implement hook_entity_type_alter() and swap in our class instead of layout builder's
Comments
Comment #2
larowlanComment #3
andypostCould it be moved to trait or some event?
Comment #4
larowlanLooks like hook_entity_view_alter is enough here
Comment #5
phenaproximaHow will we go about subclassing LayoutBuilderEntityViewDisplay in a reliable manner? It's already brought in during a hook_entity_type_alter (Layout Builder's implementation), which means the only way we could guarantee that our subclass gets used is to implement the very evil hook_module_implements_alter, which should be a last resort.
I propose an alternate approach:
Layout Builder will then respect the override data without us needing to subclass anything at all. What say you to this approach?
Comment #6
phenaproximaIn either case, I think this is probably blocked by #2941806: Create an ER field to store reference to the chosen layout on the content entity.
Comment #7
larowlanSounds like a plan
Comment #8
jibranBlocker is in.
Comment #9
tim.plunkettThis is a workaround for #2976148: Layout-based entity rendering should delegate to the correct section storage instead of hardcoding to either defaults or overrides, where we have been putting in effort instead. Not sure if this is worth continuning with that progress?
Comment #10
phenaproximaLet's just fix it in core.