PHP code example of dmstr / yii2-themed-view-path-behavior
1. Go to this page and download the library: Download dmstr/yii2-themed-view-path-behavior library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dmstr / yii2-themed-view-path-behavior example snippets
namespace project\modules\admin\controllers;
use dmstr\themedViewPath\ThemedViewPathBehavior;
class SearchGroupController extends \dmstr\activeRecordSearch\controllers\SearchGroupController
{
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['themedViewPath'] = [
'class' => ThemedViewPathBehavior::class,
'pathMap' => '@vendor/dmstr/yii2-active-record-search/src/views/search-group',
'useAsBasePath' => false,
];
return $behaviors;
}
public function actionCreate()
{
return "Action is not available in this context";
}
public function actionDelete($id)
{
return "Action is not available in this context";
}
}
namespace project\modules\admin\controllers;
use dmstr\themedViewPath\ThemedViewPathBehavior;
use yii\web\Controller;
class BaseController extends Controller
{
#....
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['themedViewPath'] = [
'class' => ThemedViewPathBehavior::class,
'pathMap' => '@project/modules/cruds/views',
'useAsBasePath' => true,
];
return $behaviors;
}
#....
namespace project\modules\admin\controllers;
use dmstr\themedViewPath\ThemedViewPathBehavior;
use project\components\ApplicationHelper;
use yii\web\Controller;
class BaseController extends Controller
{
#....
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['themedViewPath'] = [
'class' => ThemedViewPathBehavior::class,
'pathMap' => [
'@project/modules/cruds/views',
],
'subDirs' => [
ApplicationHelper::brand(),
],
'useAsBasePath' => true,
];
return $behaviors;
}
#....