[theme] Changing views path

Sarunas

New Member
I creating new theme and I want to override module views without editing script files
from:
/apps/customer/views/
to:
/customer/themes/MyThemename/views/

Is this possible?
 

Sarunas

New Member
Thanks. Nice theme but this works only in frontend :)
Maybe I can find theme for customer with custom module views from /apps/customer/views/
 

twisted1919

Administrator
Staff member
It's just an example, you can as well transform it into one for customer area, just have a look at how it is formatted, at the entry script and you'll understand how to create one for customer area as well.

Just a hint, if you create a theme for customer, say a theme named "whatever", it must contain only:
Code:
--whatever (folder containing theme files)
----- WhateverTheme.php - the entry file, copy it from the demo theme and keep only the run() method, and empty that method
----- views - the folder that can contain folders to override the ones from customer/views folder
Then just pack it, go to Mailwizz -> Backend -> Extend -> Themes, click on the customer tab and install it from there, then simply copy folders from apps/customer/views into the theme view folder in order to override the defaults.

It's harder to explain, in practice it's very simple actually.
 

Sarunas

New Member
Have one more question how to change widget path?
like:
Code:
<?php $this->widget('customer.components.web.widgets.LeftSideNavigationWidget');?>
 

twisted1919

Administrator
Staff member
if your theme is named "abc" and it is located in /customer/themes, you can create in abc a folder named components, in in a folder called web, in it a folder called widgets and in it a file called AbcLeftSideNavigationWidget.php. Inside this file you should have:
PHP:
<?php
require_once Yii::getPathOfAlias('customer.components.web.widgets.LeftSideNavigationWidget') . '.php';
class LeftSideNavigationWidget extends LeftSideNavigationWidget {

   // your code here
   public function run() {
        parent::run();
   }
}
Now you can load your new widget anywhere by simply doing:
Code:
<?php $this->widget('root.customer.themes.abc.components.web.widgets.AbcLeftSideNavigationWidget');?>
 

Dimitris

New Member
It's just an example, you can as well transform it into one for customer area, just have a look at how it is formatted, at the entry script and you'll understand how to create one for customer area as well.

Just a hint, if you create a theme for customer, say a theme named "whatever", it must contain only:
Code:
--whatever (folder containing theme files)
----- WhateverTheme.php - the entry file, copy it from the demo theme and keep only the run() method, and empty that method
----- views - the folder that can contain folders to override the ones from customer/views folder
Then just pack it, go to Mailwizz -> Backend -> Extend -> Themes, click on the customer tab and install it from there, then simply copy folders from apps/customer/views into the theme view folder in order to override the defaults.

It's harder to explain, in practice it's very simple actually.
Hello,
I have done everything so said and then I install it. But I can't see the theme in the list. I only get an empty list.
Inside the function run do I have to write something?
Thank you
 
Top