2

Is it possible to override module Module.php class to add some additional configs? I've extended some views and controllers and want to add a few additional configs for them.

enter image description here

D.R.
  • 2,540
  • 3
  • 24
  • 49

1 Answers1

3

you could create your own module in a separated vendor dir and extend the module you preferer

the sample in your image is already an ovveride (is an extension od BaseModule in this case) that redefine some function, add new param .. and os you

namespace dektrium\user;

use yii\base\Module as BaseModule;

class Module extends BaseModule
{

so in eg: myvendorname you could define a new Module.php

with

namespace myvendorname\user;

use dektrium\user\Module as MyBaseModule;

class Module extends MyBaseModule
{

  // redefine your params and functions  

  // add your new params and function

You can take a look a this for a brief guide and suggestion

http://www.yiiframework.com/doc-2.0/guide-structure-modules.html

http://www.yiiframework.com/doc-2.0/yii-base-module.html

ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
  • Yes-yes. Just what I did a few moments ago. Was ready to write the solution. Thanks again) You help me to keep my code clean and pretty) – D.R. Oct 26 '16 at 18:44
  • well I'm glad it's essentially use the object oriented features of PHP to the conventions of Yii2 framework.. .. this mena that my answer is right too – ScaisEdge Oct 26 '16 at 18:45