NodeRestrict - Stop users from adding more nodes than needed

Imagine this: You've got a setup where a specific node has to have a maximum of, let's say, 4 children. It can be a slider, a pricing section, a set of counters, whatever, but let's suppose it's not designed to work with more than this number of items. What do you do?

One thing would be to just ignore additional nodes and go for the first 4, but that could cause confusion to editors.

A better solution, as we saw it, would be to have a plugin that would allow you to restrict the number of children a node should have. Depending on what's needed, this can be done in a parent document type - child document type basis (a rule that describes that doctype A can't have more than n nodes of doctype B) or for a specific node, via a special property (which says that this specific node can't have more than n children of any type). And, of course, you can combine those two ways of restricting children.

You can still create new nodes even if you have reached the maximum number of allowed nodes, but they won't be published (they'll be saved unpublished). You need this because you can't afford to lose any data.

The plugin can be set up to display messages that warn you that a restriction is in place telling you how many nodes you are allowed to add, as well as a message when the limit is reached. Both can be customized.

Get the source code at GitHub

Download the package from Our Umbraco