Created by Michał Strychalski
MsLayoutVariables is simple Module, that allows you to set layout variables in module configs. Usefull for hiding or rendering particular elements in layout, depends on controller or module.
$ composer require mstrychalski/ms-layout-variables
Layout variables can be used in various ways, it can be limited for Action only, Module, Controller or even whole application.
'layout_variables' => [
'default' => [
'showMenu' => false,
'pageTitle' => 'Awesome title',
'someArray' => [0,1,2,3]
]
],
'layout_variables' => [
'Application' => [
'showMenu' => false,
'pageTitle' => 'Awesome title',
'someArray' => [0,1,2,3]
]
],
'layout_variables' => [
Controller\IndexController::class => [
'default' => [
'showMenu' => false,
'pageTitle' => 'Awesome title',
'someArray' => [0,1,2,3]
]
]
],
'layout_variables' => [
\Blog\Controller\IndexController::class => [
'default' => [
'showMenu' => false,
'pageTitle' => 'Awesome title',
'someArray' => [0,1,2,3]
]
]
],
'layout_variables' => [
Controller\IndexController::class => [
'index' => [
'showMenu' => false,
'pageTitle' => 'Awesome title',
'someArray' => [0,1,2,3]
]
]
],
<?php if($this->showMenu !== false) ?>
<div class="awesomeMenu"></div>
<?php endif; ?>
This is all, happy haking