MicroFrameWork/kernel/templates/views/form_template

56 lines
1.5 KiB
Plaintext
Raw Normal View History

2024-12-12 11:58:55 +03:00
<?php
/**
* @var {model} $model
*/
use kernel\app_modules\{slug}\models\{model};
$form = new \itguild\forms\ActiveForm();
$form->beginForm(isset($model) ? "/admin/{slug}/edit/" . $model->id : "/admin/{slug}", 'multipart/form-data');
// Пример формы:
/*
$form->field(\itguild\forms\inputs\TextInput::class, 'title', [
'class' => "form-control",
'placeholder' => 'Заголовок поста',
'value' => $model->title ?? ''
])
->setLabel("Заголовок")
->render();
$form->field(class: \itguild\forms\inputs\Select::class, name: "user_id", params: [
'class' => "form-control",
'value' => $model->user_id ?? ''
])
->setLabel("Пользователи")
->setOptions(\kernel\modules\user\service\UserService::createUsernameArr())
->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();