uniqby / yii2-smart-layout
Smart Layout behavior for Yii framework 2.
This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.
Package info
github.com/uniqby/yii2-smart-layout
Type:yii2-extension
pkg:composer/uniqby/yii2-smart-layout
Requires
- yiisoft/yii2: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2019-10-09 03:04:16 UTC
README
Yii2 Smart Layout behavior makes the theming of your application so simple
Installation
Composer
The preferred way to install this extension is through Composer.
Either run
php composer.phar require uniqby/yii2-smart-layout "dev-master"
or add
"uniqby/yii2-smart-layout": "dev-master"
to the require section of your composer.json
Usage
Configure Smart Layout behavior in common config:
'view' => [ 'as smartLayout' => [ 'class' => \uniqby\smartLayout\Behavior::className(), ] ]
Info
Component searches for the layout file relative to the current theme, module, controller and action.
$pathMaps = $controller->view->theme->pathMap; if (is_array($pathMaps) && !empty($pathMaps)) { foreach ($pathMaps as $path) { if ($moduleId !== null) { $layouts[] = "{$path}/{$moduleId}/layouts/{$controllerId}_{$actionId}"; $layouts[] = "{$path}/{$moduleId}/layouts/{$controllerId}"; $layouts[] = "{$path}/{$moduleId}/layouts/main"; } else { $layouts[] = "{$path}/layouts/{$controllerId}_{$actionId}"; $layouts[] = "{$path}/layouts/{$controllerId}"; $layouts[] = "{$path}/layouts/main"; } } }
Author
Alexander Sazanovich, e-mail: alexander@uniq.by