2017 © Pedro Peláez
 

yii2-extension yii2-extview

Main purpose - quick way for theming external modules with favorite template engine

image

insolita/yii2-extview

Main purpose - quick way for theming external modules with favorite template engine

  • Saturday, June 4, 2016
  • by Insolita
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Simple behavior for set module default view extension

Behavior for set custom view extension on all module, or some actions Main purpose - quick way for theming external modules with favorite template engine, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist insolita/yii2-extview "~1.0"

or add, (*4)

"insolita/yii2-extview": "~1.0"

to the require section of your composer.json file., (*5)

Usage

Once the extension is installed, simply use it in your code by :, (*6)

   'modules'=>[
         'someModule'=>[
               'class'=>'\some\Module',
                'prop'=>'foo',
               'as extview'=>[
                    'class'=>'insolita\extview\ExtviewBehavior',
                     'viewExtension'=>'twig' //it set twig extension for all module controllers

                     //Or with anonymous function with argument $route (equals \yii\base\Action $uniqueId property )
                     'viewExtension'=>function($route){
                           return($route=='some-module/default/index')?'php':'twig';
                      }
                 ]
         ]
   ]

And as usual - add module to pathmap in theme config, (*7)

'components' => [
        'view' => [
            'theme' => [
                'basePath' => '@app/themes/mytheme',
                'baseUrl' => '@web/themes/mytheme',
                'pathMap' => [
                    '@app/views' => '@app/themes/mytheme',
                    '@vendor/someModule/views'=>'@app/themes/mytheme/modules/someModule'
                ],
            ],
        ],
    ],

The Versions

04/06 2016

dev-master

9999999-dev

Main purpose - quick way for theming external modules with favorite template engine

  Sources   Download

MIT

The Requires

 

by Avatar Insolita

extension yii2 behavior view twig smarty template engine

04/06 2016

1.0

1.0.0.0

Main purpose - quick way for theming external modules with favorite template engine

  Sources   Download

MIT

The Requires

 

by Avatar Insolita

extension yii2 behavior view twig smarty template engine