PHP code example of concepture / yii2-handbook-module
1. Go to this page and download the library: Download concepture/yii2-handbook-module 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/ */
concepture / yii2-handbook-module example snippets
return [
'yii2handbook' => [
'domainMap' => [
'example1.loc' => 'example1',
'example2.loc' => 'example2'
]
]
];
Yii::$app->dynamicElementsService->getDataSet($model = null);
...
'extensions' => 'concepture\yii2handbook\twig\DynamicElementsExtension'
...
...
'extensions' => 'concepture\yii2handbook\v2\twig\DynamicElementsExtension'
...
[
...
'modules' => [
...
'handbook' => [
'class' => 'concepture\yii2handbook\Module',
'controllerMap' => [
...
'dynamic-elements' => 'concepture\yii2handbook\console\controllers\DynamicElementsCommand',
...
]
],
...
]
...
]
public function actions()
{
$actions = parent::actions();
...
$actions['robots'] = [
'class' => 'concepture\yii2handbook\actions\RobotsAction',
];
...
return $actions;
}
return [
...
[
'pattern' => 'robots',
'route' => 'site/robots',
'suffix' => '.txt'
],
...
];
...
'components' => [
'urlManager' => [
'class' => 'concepture\yii2handbook\components\routing\DomainUrlManager',
'rules' =>
...
[
'patterns' => [
DomainEnum::A => 'objects',
DomainEnum::B => 'subjects',
],
'route' => 'object/index'
],
[
'patterns' => [
DomainEnum::A => "objects/<seo_name:({$seo_name_regexp})>",
DomainEnum::B => "subjects/<seo_name:({$seo_name_regexp})>",
],
'route' => 'object/view'
],
[
'pattern' => 'robots',
'route' => 'site/robots',
'suffix' => '.txt'
]
...
...
'view' => [
...
'renderers' => [
'twig' => [
...
'extensions' => [
...
'concepture\yii2handbook\components\routing\HreflangExtension'
...
],
...
],
]
...
], ...
return [
'yii2handbook' => [
'domainMap' => [
'alias.loc' => [
'alias' => 'alias',
'locale' => 'ru',
'hreflang' => 'ru-ru'
]
]
]
];
...
use concepture\yii2handbook\actions\PositionSortIndexAction;
use kamaelkz\yii2admin\v1\actions\EditableColumnAction;
use kamaelkz\yii2admin\v1\actions\SortAction;
use concepture\yii2handbook\services\EntityTypePositionSortService;
use kamaelkz\yii2admin\v1\controllers\traits\ControllerTrait;
...
public function actions(): array
{
$actions = parent::actions();
return array_merge($actions,[
...
PositionSortIndexAction::actionName() => [
'class' => PositionSortIndexAction::class,
'entityColumns' => [
'id',
'name',
'seo_name',
],
'labelColumn' => 'name',
],
EditableColumnAction::actionName() => [
'class' => EditableColumnAction::class,
'serviceClass' => EntityTypePositionSortService::class
],
SortAction::actionName() => [
'class' => SortAction::class,
'serviceClass' => EntityTypePositionSortService::class
]
...
]);
}
...
...
use concepture\yii2handbook\actions\PositionSortIndexAction;
...
$this->viewHelper()->pushPageHeader(
[PositionSortIndexAction::actionName()],
Yii::t('yii2admin', 'Сортировка'),
'icon-sort'
);
...
...
'view' => [
...
'renderers' => [
'twig' => [
...
'extensions' => [
...
'concepture\yii2handbook\twig\SeoBlockExtension'
...
],
...
],
]
...
], ...
...
'yii2admin-navigation' => [
...
[
'label' => Yii::t('yii2admin', 'SEO блоки'),
'url' => ['/handbook/seo-block/index'],
'active' => [
'rules' => [
'c' => ['seo-block']
]
]
],
...
]
...