O
O
Oleg-Ukraine2017-07-27 15:13:49
Yii
Oleg-Ukraine, 2017-07-27 15:13:49

Custom parameters for module in yii2?

Is it possible to add custom parameters (module settings) when connecting a module in yii2? Something in the format

'modules' => [
       ...
        'mymodule' => [
            'class' => common\modules\mymodule\MyModule::class,
            'custom1' => [
                 'foo' => 'bar',
             ]
            'custom2' => 'foofoobar'
        ],
    ],

and how can I accept these parameters in module files, models, controllers?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2017-07-27
@Oleg-Ukraine

Is it possible to add custom parameters (module settings) when connecting a module in yii2? Something in the format

Yes, if you make the appropriate parameters in the module class
Depending on what the settings are, the module class itself can "push through" them, or you can use the Dependency Injection Container

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question