Skip to content
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

Limit Matrix Blocks Per Block Type #826

Closed
angrybrad opened this issue Jan 31, 2017 · 8 comments
Closed

Limit Matrix Blocks Per Block Type #826

angrybrad opened this issue Jan 31, 2017 · 8 comments
Labels
content modeling 📓 features related to content modeling matrix 🕶️ features related to Matrix fields

Comments

@angrybrad
Copy link
Member

Created by: Anonymous ([email protected]) on 2015/03/10 17:00:50 +0000
Votes at time of UserVoice import: 64


@angrybrad
Copy link
Member Author

Posted by Tom ([email protected]) on 2015/04/20 17:54:59 +0000


Definitely could use this. I often create a matrix block for a page which allows content editors to shuffle the order of blocks, but it wouldn't make sense to allow creation of more than 1 of each block type.

The way the matrix works right now seems suited to article pages for blogs posts but it definitely has other powerful uses.

@angrybrad
Copy link
Member Author

Posted by Mats Mikkel Rummelhoff ([email protected]) on 2015/03/09 00:12:31 +0000


Hopefully this ends up in core some day, but for the interim I just published a new plugin which hacks it in: https://github.com/mmikkel/limitblocktype – may be useful to someone :)

@angrybrad
Copy link
Member Author

Posted by Jason Mayo ([email protected]) on 2015/10/05 14:38:23 +0000


+1

Just needed to use this on a website where I only wanted 1 hero header (A block in a Matrix) and also only 1 map block. All the other blocks could be an unlimited amount.

But if I could restrict the map / hero header blocks to just 1 this would save a massive confusion on the clients side.

@angrybrad
Copy link
Member Author

Posted by Mats Mikkel Rummelhoff ([email protected]) on 2015/03/09 00:12:31 +0000


ACF (WordPress) has this feature in their Flexible Layout fieldtype (which works a lot like Matrix), and I really miss it in Craft.

A frequent use case for me is using Matrix fields as "layout" builders, where block types are basically pre-baked (more or less) site sections such as "Contacts listing", "Pricing table" etc., where I don't want the client to be able to add multiple "Contacts listing" or "Pricing table" blocks per field.

It isn't a huge issue as I can always filter out the extra blocks w/ Twig, but it'd be super nice to have the option to set a limit per type.

@angrybrad
Copy link
Member Author

Posted by Ryan Shrum ([email protected]) on 2015/03/10 19:11:37 +0000


I was thinking about this the other day. A case I ran in to is a block for "media reviews" (or testimonies) on a product information/landing page. You don't necessarily care what order the blocks are, but if you wanted to limit them to only having one row of reviews, that's not possible.

@angrybrad
Copy link
Member Author

Posted by Anonymous ([email protected]) on 2015/03/10 17:00:50 +0000


The use case could also be covered by the conditional field display feature request... there are times when I like the simplicity of showing options as a matrix button but I don't want them to be able to use more than a single type of block. My particular use cases could all be replicated by having optional fields listed out but I think it makes a lot more sense to my users to have the matrix button available and if they aren't going to use the fields in question they don't have to see the fields not in use. Basically I think it comes down to preference - my preference in most cases would be to use matrix blocks even if they are optional fields (for instance the background in a header image) because it is easier for my clients to understand and easier to look at... plus with matrix you get the added flexibility of block groups, disabled blocks, and the ability to reorder content. Just the way I look at it - I would be happy to explain more if need be - I know I didn't do the best job!

@angrybrad
Copy link
Member Author

Posted by Brandon Kelly ([email protected]) on 2015/03/06 03:54:45 +0000


What's the use case?

@brandonkelly
Copy link
Member

Closing in favor of #3350.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content modeling 📓 features related to content modeling matrix 🕶️ features related to Matrix fields
Projects
None yet
Development

No branches or pull requests

2 participants