backend/views/admin/post/form.php
2024-07-26 16:26:01 +03:00

54 lines
1.5 KiB
PHP

<?php
/**
* @var Post $model
*/
use app\models\Post;
use app\models\User;
$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: "content", params: [
'class' => "form-control",
'placeholder' => 'Контент',
'rows' => '10',
'value' => $model->content ?? ''
])
->setLabel("Пост")
->render();
$form->field(class: \itguild\forms\inputs\Select::class, name: "user_id", params: [
//$form->field(class: \itguild\forms\inputs\Select::class, name: "username", params: [
'class' => "form-control",
'value' => $model->user_id ?? ''
])
->setLabel("Пользователи")
->setOptions(\app\services\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();