2

Currently it's possible to set a max block value for the collection of block types. However I have a case where it would be great if I could set block type limit.

For example I have a situation where I need a carousel matrix. A block type with assests for the carousel but also a heading and text block type describing the carousel. I want the assets block type to have x amount of repeatable entries but the description and title block type limited to 1.

How would you currently achieve this? Would it be worth requesting adding it to the roadmap?

2

Reading your description I see no reason to not use all three fields in a single matrix block. If you need additional control (e.g. for positioning the title), you could add another field to that block that allows you to set your settings (e.g. a dropdown with "Title left" / "Title right" options).

If you really need a per block type limit (now), you could try fork the matrix field as a plugin and add the necessary conditionals to the JS.

| improve this answer | |
  • Thank you. The asset would need a field for title or label as well and maybe one or two more. I'll look into the plugin route. – Goldyberg Nov 25 '14 at 15:16
  • You know that you can add Asset Meta Fields to your assets, @Goldyberg? – carlcs Nov 25 '14 at 15:20
  • I did not know this, first day of playing around. This might work. Thanks for your help. – Goldyberg Nov 25 '14 at 15:30
5

I just published a plugin called Limit Block Type, which adds the ability to limit Matrix blocks per block type.

There's also a feature request for adding this feature to core.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.