I have found a pattern that works for me, in MODx 2.2.4. As far as I can tell, this will be rendered as deprecated with the coming of MODx 2.3.
The solution I found was to use the pattern described in the Doodles Tutorial multiple times. For example, say I want to create a menu item with two submenu items. So, we have:
- menu item Parent,
- menu item Child A and
- menu item Child B.
For the Parent:
- action controller: controllers/index
- controller class path: mycmp/controllers/index.class.php
- controller class name: ControllersIndexManagerController
Then, I have the method ControllersIndexManagerController#getDefaultController to return:
"home"
So, I create another class:
- controller class path: mycmp/controllers/home.class.php
- controller class name: MycmpHomeManagerController
This is the class that all my logic for the CMP goes in. The first one is only there in order to
reroute the request to this one. The rerouting takes place during the call of the "getDefaultController".
Notice that this last class configuration will be called by default in MODx 2.3 and the previous one (index) will not be needed, as long as you change the action controller to "home" (but, this is all MODx 2.3).
For Child A:
- action controller: controllers/childa/index
- controller class path: mycmp/controllers/childa/index.class.php
- controller class name: ControllersChildaIndexManagerController
Then, I have the method ControllersChildaIndexManagerController#getDefaultController to return:
"home"
again.
So, I create another class:
- controller class path: mycmp/controllers/childa/home.class.php
- controller class name: MycmpChildaHomeManagerController
The same goes for Child B.
And that is the end of my custom solution. I do not know of any other way of creating a multi-level menu with actions pointing to controllers using the schema of MODx 2.3 in MODx 2.2.4.
Please, if anyone else is using another method of action controller declaration, class path and class name configuration I would appreciate it if he/she would share it with me.