backend/views/admin/menu/form.php

79 lines
2.3 KiB
PHP
Raw Normal View History

2024-08-30 16:14:31 +03:00
<?php
/**
* @var Menu $model
*/
use kernel\models\Menu;
$form = new \itguild\forms\ActiveForm();
$form->beginForm(isset($model) ? "/admin/menu/edit/" . $model->id : "/admin/menu");
$form->field(class: \itguild\forms\inputs\Select::class, name: "parent_id", params: [
'class' => "form-control",
'value' => $model->parent_id ?? ''
])
->setLabel("Родительский пункт меню")
->setOptions(\app\services\MenuService::createLabelArr())
->render();
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "icon_file", params: [
'class' => "form-control",
'value' => $model->icon_file ?? ''
])
->setLabel("Путь к иконке")
->render();
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "icon_font", params: [
'class' => "form-control",
'value' => $model->icon_font ?? ''
])
->setLabel("Иконка")
->render();
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "label", params: [
'class' => "form-control",
'value' => $model->label ?? ''
])
->setLabel("Заголовок")
->render();
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "url", params: [
'class' => "form-control",
'value' => $model->url ?? ''
])
->setLabel("URL")
->render();
2024-09-03 16:29:44 +03:00
$form->field(class: \itguild\forms\inputs\Select::class, name: "status", params: [
2024-08-30 16:14:31 +03:00
'class' => "form-control",
2024-09-03 16:29:44 +03:00
'value' => $model->status ?? '1'
2024-08-30 16:14:31 +03:00
])
->setLabel("Статус")
2024-09-03 16:29:44 +03:00
->setOptions(Menu::getStatus())
2024-08-30 16:14:31 +03:00
->render();
?>
<div class="row">
<div class="col-sm-2">
<?php
$form->field(\itguild\forms\inputs\Button::class, name: "btn-submit", params: [
'class' => "btn btn-primary ",
'value' => 'Отправить',
'typeInput' => 'submit'
])
->render();
?>
</div>
<div class="col-sm-2">
<?php
$form->field(\itguild\forms\inputs\Button::class, name: "btn-reset", params: [
'class' => "btn btn-warning",
'value' => 'Сбросить',
'typeInput' => 'reset'
])
->render();
?>
</div>
</div>
<?php
$form->endForm();