Iām trying to implement a āMenu Builderā in DatoCMS.
Currently, I have a Menu model with a field that links to multiple MenuItem records (another model). Each MenuItem can also contain a list of nested MenuItem entries, which allows me to build a two-level menu structure.
This setup works fine, but I havenāt found a way to limit the nesting depth in the admin interface. Since I only need two levels, Iād like to prevent editors from creating a third level by mistake.
Is there a recommended way to enforce a maximum nesting depth, or a better overall approach to handling menus like this in Dato?
at the moment we donāt have a way to enforce a validation like the want you need. We have this feature request: Custom validation that you can upvote that could solve your problem down the line. Itās something that we believe should be done, so it might be added at some point.
Meanwhile, the only idea that I have is to use modular blocks instead, where you can limit the type of blocks that you can add, so you can have āfirst level menuā and āsecond level menuā blocks and you can limit it this way.
Itās not the same as using a different model, but maybe it can solve your issue?