backend/views/admin/post/form.php

52 lines
1.4 KiB
PHP
Raw Normal View History

2024-07-25 16:15:18 +03:00
<?php
/**
* @var Post $model
*/
use app\models\Post;
$form = new \itguild\forms\ActiveForm();
$form->beginForm(isset($model) ? "/admin/post/edit/" . $model->id : "/admin/post");
$form->field(class: \itguild\forms\inputs\TextArea::class, name: "post", params: [
'class' => "form-control",
'placeholder' => 'Пост',
'rows' => '10',
'value' => $model->post ?? ''
])
->setLabel("Пост")
->render();
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "username", params: [
'class' => "form-control",
'placeholder' => 'Логин',
'value' => $model->username ?? ''
])
->setLabel("Имя пользователя")
->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();