Set maximum number of a structured field in the panel

Hi everyone,

I’ve built out some structured fields for use in my admin panel. Each field creates some data for a full page (scrolljacking) slider. One of the limitations of the design and code is the number of slides (4). I was wondering if there was a way to limit the number of structures that can be made in the panel (via the add button). I feel this is a pretty niche use case, but I figured I’d poke around.

1 Like

No, there is no option to limit the number of entries (or not that I know of). You could, however, limit the number of slides shown via your template by setting the limit value to the desired number.

$slides = $page->slider()->toStructure()->limit(4);

Not tested, but sth like that should work.

2 Likes