ZF-12523: ZF2 module based layouts
I was working on zf1 and now I have decided to learn zf2. I am really facing difficulty to load layouts based on module.
Here is the scenario:
Two modules currently: Application and Admin
As Application module is activated by default, I have activated Admin module. Now every time I open url(s) example.com or example.com/admin, it loads Admin layout as it is at last index in config/application.config.php modules array.
I printed my configurations in onBootstrap method of Application/Module.php and I noticed other configurations are fine except view_manager. As I mentioned earlier Admin is last module it overrides view_manager settings ( view_manager index only loads Admin module settings ) that makes it to load admin layout. If I place Application module at last index in modules array of config/application.config.php, it will load view_manager settings from application module and so the layout.
Please guide me what to do now. I have googled and found people loading layouts by defining their configurations but that's what I am not looking for.
I think view_manager data must be wrapped in an index named as of module, if we do that and print configurations, view_manager now contains two indexes application and admin and their configurations against each index. Then zend library must load configurations based on module being browsed by user or routed.
I am anxiously waiting for your response.