• Hi, do repeatable fields and repeatable groups have any parameters that would allow me to set minimum and maximum numbers?

    I’d like a group of images, titles and captions, for example, but limited to exactly three.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Not that I can recall ever seeing, I believe the solution for this idea in the past has typically been just provide the maximum amount you wanted to have, and if they’re not filled in, they’re not used. Only downside is that depending on volume and field types, it can turn into a longer editor screen.

    Thread Starter Andy Macaulay-Brook

    (@andymacb)

    Thanks. While I’ve a general requirement, what I actually want, this time, is precisely three sets of fields that are sortable. So making three separate fields doesn’t get me far.

    I can’t find anything that would do the trick though.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Noted on that sortable part, but I can’t think of any out-of-box limiting aspect in CMB2 either. As an alternative, perhaps provide an “order” field where they can put a value that indicates which order this one should be in, say “1”, “2”, “3”, and then during output, grab all the fields and do some array sorting based on that field itself.

    Otherwise, it may be a case of adding in the intended order within the set amount of fields provided.

    Thread Starter Andy Macaulay-Brook

    (@andymacb)

    Thanks. Before I close the ticket, if I make time to code a custom field or something like that, do you know of any existing issues or blockers that would stop me either making existing fields sort or making repeated fields and groups limitable?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Nothing I can think of.

    I would make use of https://github.com/CMB2/CMB2/wiki which has a solid wealth of information about CMB2 including extending and whatnot.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Minimum and maximum numbers of repeatable fields and groups’ is closed to new replies.