share some of my experience about developing MW theme

majid1f

Active Member
MailWizz 2.0 Tester
I try to develop a theme and I want to share some of my experience,
MW design is really good and flexible for changes and with the help of Yii architecture for the flexibility, it is possible to change everything you need.
for developing a theme you need to extend ThemeInit class and then you have access some properties and methods in the extended class.
properties: `name`, `author`,...,` version`
`name`, `author`,... are used to declare your self as a developer of theme and version property used to declare the version of the theme which you developed (versioning can be used for updates)
methods: `run`, `settingsPage`, `afterEnable`,`beforeEnable`,...
`run` method is called right at system init(it works like Constructor method of PHP classes in Yii), therefore it can be used to register assets, controllers, actions, hooks, ...
`settingsPage` method can be used for backend settings of your theme.
you can import models and do model validations in this method, and in your model, you have access to Yii methods if you extends from FormModel or active record(to see more info click here)
`beforeEnable`, `afterEnable`, `beforeDelete`, `afterDelete` ... this methods can be used to do your logic before and after enable or before and after delete of your theme in the backend.
-----------------------------------------------------------------------
something about design:
for registering CSS and JS files you can add `register_scripts`, `register_styles` filters in your run method and replace or add files to added styles until this point of app cycle.
layouts and app views can be replaced in the theme, you can add views folder to your theme and app read these views instead of app views.
to see extra information about themes in yii see this link
------------------------------------------------------------------------
challenges:
1) bootstrap 3 used in the design of the MW views and if you want to use Bootstrap 4 or sth else it might be challenging for grid views, listviews ..., app views and if you want you should redesign some parts.
2) jquery is in the core part of Yii and so for MW and if you need a different version of jquery for your theme it must be challenging.
3) if you updates views in your theme it must be challenging in MW updates
 
Last edited:
I try to develop a theme and I want to share some of my experience,
MW design is really good and flexible for changes and with the help of Yii architecture for the flexibility, it is possible to change everything you need.
for developing a theme you need to extend ThemeInit class and then you have access some properties and methods in the extended class.
properties: `name`, `author`,...,` version`
`name`, `author`,... are used to declare your self as a developer of theme and version property used to declare the version of the theme which you developed (versioning can be used for updates)
methods: `run`, `settingsPage`, `afterEnable`,`beforeEnable`,...
`run` method is called right at system init(it works like Constructor method of PHP classes in Yii), therefore it can be used to register assets, controllers, actions, hooks, ...
`settingsPage` method can be used for backend settings of your theme.
you can import models and do model validations in this method, and in your model, you have access to Yii methods if you extends from FormModel or active record(to see more info click here)
`beforeEnable`, `afterEnable`, `beforeDelete`, `afterDelete` ... this methods can be used to do your logic before and after enable or before and after delete of your theme in the backend.
-----------------------------------------------------------------------
something about design:
for registering CSS and JS files you can add `register_scripts`, `register_styles` filters in your run method and replace or add files to added styles until this point of app cycle.
layouts and app views can be replaced in the theme, you can add views folder to your theme and app read these views instead of app views.
to see extra information about themes in yii see this link
------------------------------------------------------------------------
challenges:
1) bootstrap 3 used in the design of the MW views and if you want to use Bootstrap 4 or sth else it might be challenging for grid views, listviews ..., app views and if you want you should redesign some parts.
2) jquery is in the core part of Yii and so for MW and if you need a different version of jquery for your theme it must be challenging.
3) if you updates views in your theme it must be challenging in MW updates
Great analysis.
 
Back
Top