4

Hi I am using Yii2 plugin for login and user management: https://github.com/webvimark/user-management

I want to customize view files of this plugin. How can I do this without touching to core file in vendor folder?

rob006
  • 21,383
  • 5
  • 53
  • 74
Vishal Petkar
  • 369
  • 1
  • 4
  • 20
  • 1
    Possible duplicate of [How to customize vendor view files?](https://stackoverflow.com/questions/31231120/how-to-customize-vendor-view-files) – robsch Jun 26 '18 at 06:31

2 Answers2

1

You can use theming to override some view files. In your config:

'components' => [
    // ...
    'view' => [
        'theme' => [
            'pathMap' => [
                '@vendor/webvimark/module-user-management/views' => '@app/views/user-management',
            ],
        ],
    ],
],

Then put your views into @app/views/user-management directory.


But if extension is not maintained anymore you may consider forking extension, do changes in fork and use it as a dependency.

rob006
  • 21,383
  • 5
  • 53
  • 74
0

Extent the component/module and the class in your project

Create User Config Class extends from the UserConfig.

class YourClass-UserConfig extends webvimark\modules\UserManagement\components\UserConfig
{
/* Custom As you want  */
}

and UserManagementModule

class YourClass-UserManagementModule extends webvimark\modules\UserManagement\UserManagementModule
{ 
/* Custom As you want */
}

and in config add your component

components'=>[
    'user' => [
        'class' => 'YourPackage\YourClass-UserConfig',
    ],
],

'modules'=>[
    'user-management' => [
        'class' => 'YourPackage\YourClass-UserManagementModule',

In your class custom as you want.

ِAmin
  • 162
  • 1
  • 17