5

In yii2 how do I customize vendor view files without modifying the original view files?

I'm using dektrium yii2-user and would like to make a few changes to the login page.

Roger
  • 53
  • 4

1 Answers1

5

You can assign your view path for dektrium yii2-user in this way (assume @app your app alias) :

'components' => [
    'view' => [
        'theme' => [
            'pathMap' => [
                '@dektrium/user/views' => '@app/views/your_dir_views'  // mapping for override the views dektrium with  your views 
            ],
        ],
   .....
 ],
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
  • Hi. I tried to apply your solution to change the login view of webvimark/user-management extension and it didn't work. I had to change the configuration of the extension/module by adding 'viewPath' => '@app/views/user-management' – Evandro P. Alves Nov 12 '15 at 14:19
  • its a worth to mention, that albeit in your example there are multiple dots after component, view field must be on the first level after components, view is not a property of specific component or module but of field "components" directly, then it works – FantomX1 Feb 10 '18 at 17:06
  • 1
    @FantomX1 .. corrrect and your comment is useful .. the dot was for only for others component section not for level ..answer updated .. based on yoru suggestion (removed the top dot sequence) – ScaisEdge Feb 10 '18 at 17:14
  • thank you, took me a while myself finding out why it didn't work as a field of a specific component and I would be about throwing your solution if some colleague didn't help me a bit there, but seeing your solution now as it is would definitelly immediatelly remove any barriers – FantomX1 Mar 07 '18 at 07:36