Replies: 15 comments 1 reply
-
Technically this is a duplicate of #826 but I’ll close that one instead as it never received any new activity since we switched from UserVoice to GH issues. It’s easy enough to add it, but I’d like to better understand the use case. What sort of block within a Matrix-powered page builder would need to be limited to only use X times? |
Beta Was this translation helpful? Give feedback.
-
Often times I'll use a matrix field to build a modular page. Each matrix block is a module, and the module types would include: hero, image + copy, video, map, etc. "Hero" or "Map" might only make sense to be included in the page once, but still orderable within all modules. |
Beta Was this translation helpful? Give feedback.
-
My usage case is much like @richardcalahan is saying, with the difference that I also use Matrix to use custom (twig) components, let's say you have Using this blocks/components, I might want to limit the usage of for the |
Beta Was this translation helpful? Give feedback.
-
Another use case are social media channels. Imagine you have a channel of persons and each person should be able to insert social media links or whatever information we require (different api tokens and what not) Of course one could argue this is better off as a separate field type but I like to use a matrix where the different block types represents different platforms and limit them via JavaScript to one since it doesn't make sense to show the Facebook icon twice next to each other in a teaser/block/header.. Matrix blocks are not always used as a page builder. It's their main purpose of course but you can use them as a simple collection container as well |
Beta Was this translation helpful? Give feedback.
-
That reminds another usage I give to this field. Depending on the project I might use a Matrix on a Global set to create a |
Beta Was this translation helpful? Give feedback.
-
Just recently i also had situation when this would be usefull - dont need multiple sections "sign up for newsletter", but i need multiple sections "products from specific category" - for example. |
Beta Was this translation helpful? Give feedback.
-
I've needed this on several occasions. We use matrix blocks for main content or homepage blocks and typically only want one of each block, or sometimes just one block of a few types. |
Beta Was this translation helpful? Give feedback.
-
Yep, could really do with this. Some use cases I've hit recently: Homepage with matrix with blocks (because client would like to reorder output of sections), but each block should only be displayed once. Matrix used for Slideshow, or display of any set of same blocks (e.g. Bios etc), but where there's a block used for headline/intro first. That should only display once, but block type of slide (or bio etc) should be multiple. Matrix used to display set of 4 panels within a page, but should only use each once. Reason being each has slightly different fields to provide content. Again, using Matrix so client can rearrange the order of them. |
Beta Was this translation helpful? Give feedback.
-
Seems to want to occur to me that if you do this, it would be good to have some flexibility in what accounts for uniqueness. Type is one factor, but a string or numeric match (make use of PHP''s looseness??) on a chosen field could be another. Thus you could assure you didn't try to make an employee bio, a product card, etc. over again, due to differing or updated information. Likely a field opens here also of providing a facility to find duplicated blocks, remind you if you try to save them, etc.... |
Beta Was this translation helpful? Give feedback.
-
Any idea if this will see the light of day @brandonkelly? Missing this so much! 🙏 |
Beta Was this translation helpful? Give feedback.
-
This can be done with MatrixMate. Invaluable plugin, IMHO. Look for the 'maxLimit' config option for each block type. |
Beta Was this translation helpful? Give feedback.
-
I could use this on a specification table for a product. Imagine a series of key/value pairs that describe specs for a product (e.g. height: 10, weight: 20, etc.). The layout we're working with has a one column option for products with a few specs and a two column layout for products with a lot of specs. With a block type limit I could have a block type of "column break" that can only be used once. Without the limit I'll end up creating two matrix fields for "Specs first column" and "Specs second column" which is a little less elegant. |
Beta Was this translation helpful? Give feedback.
-
Any plans to bring this to Craft 4? @brandonkelly |
Beta Was this translation helpful? Give feedback.
-
With the sunsetting of Matrixmate for Craft 5 - is there currently a way to do this natively or another solution anyone has found? Losing this capability is currently the only thing keeping us from upgrading from 4 - 5. |
Beta Was this translation helpful? Give feedback.
-
We also use this feature a lot where matrix fields are used for the main content, and sometimes a block type is needed only once or twice for a page, like the banner or the map block. Any plans to bring this to Craft 5? @brandonkelly |
Beta Was this translation helpful? Give feedback.
-
Description
So I am using
Matrix
field to create data structure for twig components that stack on top of each other in a generic page. I do not want to create any limitation on the number of blocks but it would be interesting and useful to be able to set a limit also on a specific block type.Would this be something you see being added in a future release?
Additional info
Beta Was this translation helpful? Give feedback.
All reactions