-
Notifications
You must be signed in to change notification settings - Fork 641
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: be able to add limit on a block type in a Matrix field #3350
Comments
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? |
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. |
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 |
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 |
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 |
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. |
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. |
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. |
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.... |
Any idea if this will see the light of day @brandonkelly? Missing this so much! 🙏 |
This can be done with MatrixMate. Invaluable plugin, IMHO. Look for the 'maxLimit' config option for each block type. |
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. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
The text was updated successfully, but these errors were encountered: