Craft CMS plugin adding option to limit individual Matrix block types.
Matrix is lacking an important feature – the ability to limit blocks per block type.
This tiny plugin (which was surprisingly difficult to build) fixes that.
Limit Block Type works with your existing Matrix fields.
Add the desired number of max blocks to your each of your block types’ settings (by clicking the block type settings’ cogwheel inside the Matrix configurator). Profit.
Limit Block Type is basically one huge hack, and could break at any time (for instance, if P&T redesigns the Craft Control Panel). The plugin is designed to die gracefully and not kill your editing experience if it ever stops working, but please keep this in mind.
Also, if P&T ever adds this feature to the core, this plugin will immediately be retired. +1 for core feature, though – please vote for the feature request!
To install Limit Block Type, follow these steps:
- Download & unzip the file and place the
limitblocktype
directory into yourcraft/plugins
directory - -OR- do a
git clone https://github.com/mmikkel/limitblocktype.git
directly into yourcraft/plugins
folder. You can then update it withgit pull
- Install plugin in the Craft Control Panel under Settings > Plugins
- The plugin folder should be named
limitblocktype
for Craft to see it. GitHub recently started appending-master
(the branch name) to the name of the folder for zip file downloads.
Limit Block Type requires Craft 2.6.x or newer.
This plugin is provided free of charge and you can do whatever you want with it. Limit Block Type is unlikely to mess up your stuff, but just to be clear: the author is not responsible for data loss or any other problems resulting from the use of this plugin.
Please report any bugs, feature requests or other issues here. Note that this is a hobby project and no promises are made regarding response time, feature implementations or bug fixes.
- Fixes an issue where Limit Block Type would break password resets (undefined index)
- Fixed a bug
- Initial release
Brought to you by Mats Mikkel Rummelhoff