I
I
Ilya Beloborodov2017-02-25 16:47:54
Yii
Ilya Beloborodov, 2017-02-25 16:47:54

Assign a template for a module via config?

I downloaded the module for yii2.
There was a need to assign a template to this module, I don’t want to climb into the module itself, which lies in the vendor folder, and it’s not right. Can it be done somehow like this?

'modulename' => [
            'class'  => 'module\yii\class\Module',
            'layout' => '@app/views/layout'
        ],

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya Beloborodov, 2017-02-25
@kowap

Hmm. Ashamed

'modulename' => [
            'class'  => 'module\yii\class\Module',
            'layout' => '@app/views/layout'
        ],

S
Slava Vitrenko, 2017-02-26
@mxuser

Here is an example of redefining the theme for the dektrium/user extension:
(The "components/view" section in the config)

'components' => [
        'view' => [
            'theme' => [
                'pathMap' => [
                    '@dektrium/user/views' => '@app/views/user'
                ],
            ],
        ],
]

Thus, we tell the framework that we need to first look for view files in the folder we specified, and then in the folder with the module
Try by analogy

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question