Hi,
I'm not sure if this fits here... I'm quite new to Zend Framework 2, but
looking through the code of the framework itself and some other
modules/libraries I've started the development of a ThemeManager library. The
library is located at:
https://github.com/shadowfax/zf-themes
I would be very pleased if someone could take a look at it and send me comments
on bad practices I've made or bad code (I guess there should be some of those),
if someone would contribute that would make me even happier (but not asking so
much).
My main goals are:
Maintain ZF2 views structureEasy to integrateAssets per module and theme.
I've found out some classes are difficult to extend. I've created a new
Mvc/Application just for the init method so it loads my theme service and a
bootstrap listener. If I could hook a global onBootstrap event I guess this
could be neater however initializing the new class makes some sense as it is a
theme application.
I've created a new feature for the modules which tells the ThemeManager that
modules supports and makes use of themes. This way I add the view path from
code. Basically instead of using the 'view' directory I use 'themes/theme_name'
directory to hold the views in the same way the original directory did.... If
no matching theme exists for a given module it uses the 'Default' theme.
Assets are located inside 'themes/theme_name/assets/'. The service creates a
route named 'assets' (To be exact the one that is interesting is
'/assets/module/wildcard'. This route is only used for matching and gives us
one parameter which is the module name and a wildcard which is the path to the
asset relative to the assets directory for the module. This way each theme may
contain it's own assets.
Right now I've created one adapter which will use the directory structure and a
json file that gives information about the theme. I'm planning on adding some
new adapter for Database driven theme information (ZF2 database and Doctrine).
Thanks you for reading untill the end.