We have a content type
pageand taxonomic vocabulary
page has reference to a
section has reference to a
menu. In addition, we are interested in being able to build layouts per node, based roughly on the following:
The problem with the above structure is that the header (red) is node-specific and the actual content (green) is node-specific, but they are disconnected.
The menu is not specific to a node, it simply depends on a node, but it is actually the menu of the section. It must be displayed automatically if the node belongs to the section to which the menu has been assigned.
This disconnection of content creates a problem with regard to the
Layout Builder. Why? Because through
Layout Builder The node is built from sections, namely their layout. Sections act as a multi-valued field, they are rendered linearly to create the final result.
They can not be grouped or nested, which could potentially solve a problem, because if we could nest sections, we could simply create a section with header, section with menu and content, and in nested content several sections with several presentations. However, we have to do this in a linear way and we have a problem because we can create a section for the header, a section for the menu and the content, but we can not create multiple layouts for the content, because they require nesting.
Few solutions to this problem come to mind.
- To make the header and menu outside the layout generator, simply place them in the
node.html.twigwhich would extract the required data for the header and render them correctly outside the
We do not feel well, because the best thing would be to manage all the content of the node in the
layout builder, without making such exceptions. But as mentioned, the layout builder seems to only handle linear content, so it seems impossible to separately process the header and other content, as different regions, to which multiple sections could be added. The regions seem to exist only in sections, not outside of them.
Use something like https://www.drupal.org/project/mini_layouts to allow nesting of the layout. This introduces dependency on a module in alpha version, but seems to be the best choice at the moment. Content that is not a header could then be put into mini-layouts.
Somehow change the rendering / editing of layouts to allow me to have at least one level of nesting. The best thing would be for each section to have a "region" to which it belongs – which might perhaps be possible if I could create an "overlay", which would be an effective layout.
As you can see, I am aware of many more or less radical solutions to this problem, but I am looking for something that would be the least effective of all. Maybe I miss a popular contrib module, which would help in a more elegant way than other ideas?
Edit: It has just come to my mind. Can I effectively achieve an extra level of nesting by creatively using section setup? Could I make the section so configurable to the point of defining its "sub-layers"? In fact, this seems like a very clean way to achieve what I have to accomplish without adding addiction. Hmmm. Is there anything better?