2017 © Pedro PelĂĄez
 

library ms-layout-variables

MsViewElements is simple ZF3 module for managing layout variables from module configs

image

mstrychalski/ms-layout-variables

MsViewElements is simple ZF3 module for managing layout variables from module configs

  • Thursday, September 7, 2017
  • by mstrychalski
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

MsLayoutVariables

Created by MichaƂ Strychalski, (*1)

Introduction

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., (*2)

Installation using Composer

$ composer require mstrychalski/ms-layout-variables

Usage

Layout variables can be used in various ways, it can be limited for Action only, Module, Controller or even whole application., (*3)

Whole application

'layout_variables' => [
        'default' => [
            'showMenu' => false,
            'pageTitle' => 'Awesome title',
            'someArray' => [0,1,2,3]
        ]
    ],

Limited to Module

'layout_variables' => [
        'Application' => [
            'showMenu' => false,
            'pageTitle' => 'Awesome title',
            'someArray' => [0,1,2,3]
        ]
    ],

Limited to Controller in local namespace

'layout_variables' => [
        Controller\IndexController::class => [
            'default' => [
                'showMenu' => false,
                'pageTitle' => 'Awesome title',
                'someArray' => [0,1,2,3]
            ]
        ]
    ],

Or somewhere else

'layout_variables' => [
        \Blog\Controller\IndexController::class => [
            'default' => [
                'showMenu' => false,
                'pageTitle' => 'Awesome title',
                'someArray' => [0,1,2,3]
            ]
        ]
    ],

Limited to Action

'layout_variables' => [
        Controller\IndexController::class => [
            'index' => [
                'showMenu' => false,
                'pageTitle' => 'Awesome title',
                'someArray' => [0,1,2,3]
            ]
        ]
    ],

And now you can use it in your layout:

<?php if($this->showMenu !== false) ?>
    <div class="awesomeMenu"></div>
<?php endif; ?>

This is all, happy haking, (*4)

The Versions

07/09 2017

dev-master

9999999-dev https://github.com/mstrychalski/MsLayoutVariables

MsViewElements is simple ZF3 module for managing layout variables from module configs

  Sources   Download

The Requires

  • php >=5.3

 

by MichaƂ Strychalski

zf3