<div class="book-form"> <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'imageFile')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['allowedFileExtensions' => ['jpg', 'gif', 'png']]]); ?> <?php echo $form->field($model, 'released_at')->widget(DateTimePicker::classname(), ['options' => ['inline' => true, 'format' => 'unixtime', 'timepicker' => false]]); ?> <?php $authors = Author::find()->orderBy('firstname, lastname')->all(); $authorsList = ArrayHelper::map($authors, 'id', function ($model, $defaultValue) { return $model->firstname . ' ' . $model->lastname; }); echo $form->field($model, 'author_id')->dropDownList($authorsList, ['prompt' => 'Select author of the book...']); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div>