Layout field, control available blocks for each layout

Hi,

I have a use-case where user needs to build pages from a limited set of available blocks. So initially I turned to blocks.

But some of this ‘blocks’ are two-column, and consist of one basic block on the left (i.e. image), and one on the right (i.e. quote). So I turned to layout.

But layout seems too flexible, and cannot be limited. I only want to allow for certain blocks to be added to a two column layout, and only one block on each side. I don’t want the user to add two blocks on the left column, three on the right. I also don’t want the user to add any kind of block to any layout.

More specifically the user should be able to fill a 1/2 layout with any combination of image, quote, text, and a custom page field. But only one on the left, one on the right.

These blocks could also be added to a 1/1 layout. Other blocks such as video, and a custom pages field, can only be added to a 1/1 layout.

As far as I see this cannot be configured, can it ?

/Edit, alternatively I am thinking about using custom blocks that contain the possible combinations of fields I need, limiting them if necessary /

Thank you

While there is this, GitHub - rasteiner/conditionalblocks: Kirby 3 plugin: disables blocks in layout fields when the column width does not match the block requirements, it doesn’t fulfill all your requirements. I’d go with the blocks option

There’s an easy, although hacky alternative. Using CSS’s :has selector we can check if the current selected layout column is e.g. a 1/1 and then hide/show certain blocks in the dialog. Here’s the snippet:

.k-panel:has(.k-layout[data-selected="true"] .k-column[style*="1/1"]) .k-dialog.k-block-selector .k-block-types .k-button[aria-label="Heading"] { display: none }

To use it for different layouts and/or blocks, just change 1/1 and Heading . Obviously people will still be able to paste blocks.