Add ability to only allow X numbers of layout instances
It could be useful to be able to limit the amount of times a layout can be added to the flexible field.
For example, if the field is used as a replacement for the BelongsToMany field, it is necessary to limit to 1 the amount of times a layout can be added, as adding 2 of the same layout is going to cause the first one to be overriden by the second one.
Another, maybe simpler example:
We have a Flexible field to allow the user to construct their About page with predefined sections. But maybe we want to limit the Contact info section to only appear once on the page. If the user has already added a Contact info section, the option would then be either removed or greyed out from the list when adding a new layout, maybe with a helpful tooltip message explaining that they have exceeded the maximum amount this section allows.
does anyone has figured this out ?
I actually wrote a similar feature on my fork, I'll modify it to solve this issue and make a PR
@m-triassi That would be super nice, thank you!
A part of the feature request has been merged in v0.1.9 (the Flexible::limit() method).
We still need the ability to limit the number of instances of each layout type individually.
Any updates on this?
Hi @KasparRosin, this is low priority for us and falls behind a lot of the other issues, so it may be a while. PRs are welcome, though!