This is a Zend Framework 3 module, that can simply set different layouts for different modules.
If you have multiple modules in your application (e.g. Application and Admin), and you want different layout for some module (e.g. Admin), this package will provide easiest way to do that change.
Simplest way to install this package is to use following composer command to require dependency:
composer require petrofcikmatus/zf-layout-change
Alternatively you can add following to your composer.json file manualy:
{
"require": {
"petrofcikmatus/zf-layout-change": "dev-master"
}
}
and execute composer command to update your dependencies (and also download this new one):
composer update
When you add this package with composer, it should automatically ask in which file you want add new module.
If this did not happen, you have to add 'ZFLayoutChange'
value to the array with your modules. It should be in file config/application.config.php or config/modules.config.php, and look like this:
<?php
return [
'modules' => [
// your other modules
'ZFLayoutChange', // new line
],
];
Add a new array with key module_layouts
in your global configuration file config/autoload/global.php, or to module.config.php for some modules if you want.
<?php
return [
// your other config arrays
'module_layouts' => [
'Admin' => 'layout/admin',
],
];
In the example above, controllers in Admin module (and namespace) will use layout layout/admin. Otherwise, it will use default configured layout.
Enjoy your layout changing :)
If you see any bug or you experience any troubles, please open a new issue or commit bugfix, I will look at it.
If you want to change something (maybe I didn't make it the best way), feel free to fork repository and create new merge requests.
Also if you want this on Zend Framework 2, feel free to contribute. I do not use ZF2 anymore, so it is up to you now.
This module uses MIT license.