MicroFrameWork/kernel/modules/menu/views/form.php
2024-09-10 16:44:27 +03:00

90 lines
2.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* @var Menu $model
*/
use kernel\models\Menu;
$form = new \itguild\forms\ActiveForm();
$form->beginForm(isset($model) ? "/admin/settings/menu/edit/" . $model->id : "/admin/settings/menu", 'multipart/form-data');
$form->field(class: \itguild\forms\inputs\Select::class, name: "parent_id", params: [
'class' => "form-control",
'value' => $model->parent_id ?? ''
])
->setLabel("Родительский пункт меню")
->setOptions(\kernel\modules\menu\service\MenuService::createLabelArr())
->render();
if (!empty($model->icon_file)){
echo "<div><img src='$model->icon_file' width='200px'></div>";
}
$form->field(class: \itguild\forms\inputs\File::class, name: "icon_file", params: [
'class' => "form-control",
'value' => $model->icon_file ?? ''
])
->setLabel("Путь к иконке")
->render();
$form->field(\itguild\forms\inputs\Checkbox::class, "hashing", params:[
'value' => false
// 'class' => "form-control"
])
->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();
$form->field(class: \itguild\forms\inputs\Select::class, name: "status", params: [
'class' => "form-control",
'value' => $model->status ?? '1'
])
->setLabel("Статус")
->setOptions(Menu::getStatus())
->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();