phundament / app

Dockerized Yii2 web application base
http://phundament.com
Other
310 stars 129 forks source link

Cleaner way to override admin layout for user module #206

Closed david-sa closed 8 years ago

david-sa commented 8 years ago

It seems that the reason of these files is just to apply @app/views/layouts/box to the admin section of the user module.

As you can read here, a cleaner way to achieve it is by updating the controller map:

        'user' => [
            ...
            'controllerMap' => [
                'admin' => [
                    'class' => 'dektrium\user\controllers\AdminController',
                    'layout' => '@admin-views/layouts/box',
                ],
            ],
        ],

If the development of phd4 is already over, maybe you can have it in mind for phd5. (Edit: I just saw that in phd5 you are using a different approach)

schmunk42 commented 8 years ago

Thank you! That's also a nice solution. I was using dependency injection, like so:

Yii::$container->set(
    'dektrium\user\controllers\AdminController',
    [
        'layout' => '@backend/views/layouts/box'
    ]
);

btw: phd4 and phd5 are not very different, the main difference is that phd5 has much less code :)

david-sa commented 8 years ago

Thank you for the info!

I think I can close this one.