On Fri, Sep 13, 2013 at 5:17 AM, Juan Pedro Gonzalez <unaputacue...@hotmail.com> wrote: > Hi Matthew, > > I've tried with ModuleEvent::EVENT_MERGE_CONFIG but it won't trigger on my > test application; ModuleEvent::EVENT_LOAD_MODULE and > ModuleEvent::EVENT_LOAD_MODULES_POST do trigger.
Can you show when/how you're registering your listener? > On application.config.php I've just got: > > 'modules' => array( > 'ThemeManager', > 'Application', > ), > > Using ZendFramework 2.2.4 > > Also got a new question, is there any way to get the module directory in > ZF2? Right now for module-specific themes I'm requiring the module to > implement a function getDir() so I can return the __DIR__ constant to the > listeners. This makes forces me to a create an array holding the module > path, and two additional paths for template_path_stack (One for the > view_manager and another for the theme_manager)... I guess I could avoid > saving the template_path_stacks if EVENT_MERGE_CONFIG would trigger, but it > seems I still would have to keep track of module paths. > > Let me explain the internals a little: > > $config['theme_manager']['template_path_stack'] would be the path to the > themes folder. I guess i cannot load the stack at any stage earlier than > Bootstrap (Best place would be something like EVENT_BOOTSTRAP_POST but can > not find something like this so I use a low priority -10000). This way the > developper can change the theme however he wants (Database, config file, > etc). > > I also get a hold of $config['view_manager']['template_path_stack']... The > main reason is I haven't figured a better way to set the template_path_stack > on post Bootstrap than replacing all loaded paths with a new one... However > I don't want to break ZF2 functionality; for example, forcing to modify > existing modules such as ZfcUser, BjyAuthorize... as they won't have a > theme, only the ViewManager configuration... therefore I should late load > all template stacks to achieve my goal: Theme template_stacks first, view > template_stacks last. This way I guess the ViewManager template stack would > be used as a fallback if no theme is configured for a given module, or if an > specific template does not exist for a given module and the ViewManager has > been set. > > My goal right now is having a single folder for the themes, common to all > modules... if the module specifies a theme folder, this folder should be > used as a fallback if the main theme folder doesn't find the template, and > even another fallback to use the ViewManager if the theme is missing that > template. The public folder would be defined in a global autoload config > file, so I can not do much until they have been loaded (I guess on > EVENT_BOOTSTRAP) but, as stated earlier, at that stage I could only load a > default theme configured in that file as I still need to know if the > developper is loading another theme inside the EVENT_BOOTSTRAP. > > I'm not sure if I'm messing things a little.... > -- Matthew Weier O'Phinney Project Lead | matt...@zend.com Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com