Closed luxlogica closed 2 years ago
Actually, even if all we had was min
as well as max
options at the FIELD level, that would already enable us to find a workaround: we could use multiple builder fields instead, and that would also work:
hero:
type: builder
label: Hero Banner
# always need to have 1, and only 1
min: 1
max: 1
filedsets:
[...]
info:
type: builder
label: Info Sections
# no restrictions, can specify as many as needed
fieldsets:
[...]
contact:
type: builder
label: Contact Section
# one only, or none at all
max: 1
fieldsets:
[...]
I’ll change the title of the issue to reflect.
Closing this issue because this plugin will no longer be maintained, as its main functionality can be replaced by Kirby's built-in Blocks Field and Layout Field.
Use-Case: Landing Page Sections
We want to be able to allow the client to add Landing Pages to their site. Each Landing Page is going to be structured like this:
Solution
In this common scenario, just having a
max
option at the builder field level is not enough: the user could easily delete the mandatory sections (hero, contact), as well as add multiple, unnecessary hero or contact sections that are not wanted.We need to be able to specify in each fieldset how many blocks of that type should be allowed. It is also necessary to have an accompanying
min
option, so we can specify that some blocs are required - and once that min number is reached, then the 'delete' option for the block should be greyed out. Example: