Just wondering, is there any way to do following: - define module own routes - preloaded these rules somehow
The problem is that I'm using rule:
'(:any)?' => 'index/index',
To redirect everything to one single controller (this is fine), but want to exclude some modules from there. I'm not quite sure how these routes are resolved (order seems to be critical here I pressume) so if I define something like (before :any) :
'modulename/dashboard' => 'modulename/dashboard',
I can get what I want, but I need to provide full list of these excluded routes and put it into main routes file, without any need to manual edit routes.php file.
So the question is: can I somehow define routes separately for each module inside module config (keeping in mind that I have :any rule in main routes config )?
or maybe I can predefine one method called 'load', and load all modules by HMVC call, or maybe define somehow one single rule starting with /load/module/action to route to /module/action ?
The quickest solution is to use the 404 route for it, basically saying "if you can't find it, go to index/index".
Alternatively you can overload the Module class, and either code up an alternative way of loading and processing module routes, or give modules a bootstrap file, like packages do. And in that you can do whatever you want. You can check the Package class to see how a bootstrap is processed.