How about THEME management?
Posted 24 January 2012 - 05:08 PM
I didn't see any information about theme management here. Is it gonna change at all, or we can keep using Yii 1.x themes?
The maker rests. The wheel’s in motion.
-- Imre Madách
check out Yii2 Theme Factory at http://yii2.themefactory.net
Posted 25 January 2012 - 04:24 PM
Also a possibility to theme widgets would be cool.
Posted 25 January 2012 - 04:40 PM
Posted 25 January 2012 - 04:46 PM
as a cross-reference: http://www.yiiframew...post__p__108123
Posted 09 April 2013 - 06:26 AM
While it's not perfect, it enhances to flexibility of theme usage in Yii 1.x. Basically you can pre-select a theme by a reg-ex on a controller route.
Posted 09 April 2013 - 06:53 AM
- The skin feature is dropped
- WidgetFactory is dropped and replaced with global configuration of all classes (i.e., widgets and other non-widget classes can be globally configured like in 1.1)
- Theming is now done by replacing path prefixes. This allows theming both view names and view files. For example, if "/home/qiang/test.php" needs to be themed, and the theme has a path map "/home/qiang" => "/home/schmunk", then the themed version would be "/home/schmunk/test.php".
I looked at your multi-theme extension. It may be useful in a setup that mixes backend and frontend. In a setup like described below, this is not needed: http://www.yiiframew...ii-project-site
Posted 09 April 2013 - 07:05 AM
Personally I would like this functionality expanded a little. Also to make full use of this functionality, I want the ability to set multiple directories for controllers
But this probably is an edge case, so you can ignore it
Posted 09 April 2013 - 09:05 AM
Can I overwrite the theme for that module - partially for some controller actions or even views - with the global configuration?
Or do I have to stick with something like the current theme manager replacement?
Posted 09 April 2013 - 09:40 AM
For your particular example, you could add a path map like: '@yii-user/views' => '@webroot/themes/mytheme/yii-user', and you can then customize the view files and resource files for the module.
Posted 10 April 2013 - 02:05 AM
My default view files contain, for example, a widget @widgets.CBreadcrumbs. What my custom Controller does is first look in <theme>.protected.widgets if the widget exists. If it does that's the widget that's used. If it does not exist, it looks for the widget in the webroot.protected.widgets (i.e. <theme> is replaced by 'webroot') and uses the widget found there.
I guess its clear that the default CBreadcrumb contains all the functionality required but uses a different representation from that of, say, Bootstrap. This way I don't need to create a theme specific viewfile just to include a widget with a similar API but different representation.
I'm not quite sure if this results in the same functionality as the yii2 path mapping.
In addition to this my <theme>/protected directory also may contain a class file Theme (class Theme extends CTheme). If this theme-specific Theme class exists it is used by the themeManager to represent this theme. I mainly use this feature to set a (user specific) color which is used to compile the less files into css files and sometimes to configure portlet containers.
Finally I define the path alias 'theme' when a theme is set. Obviously it points the the /themes/myTheme path.