share some of my experience about developing MW theme

Discussion in 'Themes' started by majid1f, May 4, 2019.

  1. majid1f

    majid1f Member

    Joined:
    Feb 23, 2015
    Messages:
    112
    Likes Received:
    18
    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: May 4, 2019
  2. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    10,048
    Likes Received:
    2,344
    well, at least we do have good parts too :D
     
  3. Vpul Shah

    Vpul Shah Active Member Support Staff

    Joined:
    Feb 23, 2015
    Messages:
    733
    Likes Received:
    116
    S.E:
    2019-12-22 13:03:57
    L.T:
    Regular
    L.C:
    1
    Great analysis.
     
  4. majid1f

    majid1f Member

    Joined:
    Feb 23, 2015
    Messages:
    112
    Likes Received:
    18
    most users just think about UI/UX and maybe not get the powerful of backend. MW has a great and solid core.
     
    twisted1919 likes this.

Share This Page