Yii2 Backend Theme
Установка
"mihaildev/yii2-backend-theme": "*"
Настройка
'components' => [
'backendTheme' => [
'class' => 'mihaildev\backendTheme\Component',
'homeUrl' => ['/backend/index'],
'templates' =>
[
'main.block.navbar' => '@app/views/backend/block/navbar',
'main.block.sidebar' => '@app/views/backend/block/sidebar',
// default values
//'main' => '@mihaildev/backendTheme/views/main',
//'clear' =>'@mihaildev/backendTheme/views/clear',
//'main.block.navbar' => '@mihaildev/backendTheme/views/block/navbar',
//'main.block.copyright' => '@mihaildev/backendTheme/views/block/copyright',
//'main.block.sidebar' => '@mihaildev/backendTheme/views/block/sidebar',
//'main.block.settings' => '@mihaildev/backendTheme/views/block/settings',
],
/*
'params' =>
[
'default' => [
'skin' => 'skin-blue'
],
'copyright' => [
'fromYear' => '',
'author' => 'MihailDev',
'url' => 'https://github.com/MihailDev'
],
'mainSettings' => [
'enable' => true,
],
]
*/
],
],
Использование
Отображения списка пользователей, (*1)
setTitle('Users')
->setBreadcrumbs(['Users']);
?>
= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'name',
'email:email',
['class' => 'yii\grid\ActionColumn', 'template' => '{update} {delete}'],
],
]); ?>
Авторизация, (*2)
title = 'Login';
$this->params['breadcrumbs'][] = $this->title;
?>
= Html::encode($this->title) ?>
Please fill out the following fields to login:, (*3)
'login-form',
'options' => ['class' => 'form-horizontal'],
'fieldConfig' => [
'template' => "{label}\n
{input}
\n
{error}
",
'labelOptions' => ['class' => 'col-lg-1 control-label'],
],
]); ?>
= $form->field($model, 'login') ?>
= $form->field($model, 'password')->passwordInput() ?>
= $form->field($model, 'rememberMe', [
'template' => "
{input}
\n
{error}
",
])->checkbox() ?>