Problem/Motivation
I applied the patch in #2952967: When allowing content items to have customized layouts, clicking 'Layout' on full view of a node takes you to the configuration for the 'default' view mode to my 8.5.0 project. Even with the patch applied, I was not able to view customized layouts on a per node basis.
Steps to reproduce:
- Enable the "full content" view mode for basic page
- Check "Allow each content item to have its layout customized."
- Create a new basic page
- Click "Layout" and add a block to the layout (I used the powered by Drupal block)
- Save the layout and view the node
I expected to see the customized layout with the new block added, but only the default layout appeared.
It appears that the allow_custom
setting applies on a per-view mode basis. The third party settings config object for the view mode's layout_builder does not include that flag for any view mode configuration other than the default. LayoutBuilderEntityViewDisplay checks this value before it decides whether to return the section configuration from the view mode config or the customized layout stored with the node.
Proposed resolution
I updated the form method in LayoutBuilderEntityViewDisplayForm
to include the layout options form elements for both "default" and "full" view modes and updated my view mode configuration. The customized layout was then used when viewing the node.
I am not sure this is the best solution as it appears that the layout stored with the node is not associated with a particular view mode so the updates would show for any view mode which can be customized. I think this can cause unexpected behavior as it is.