/** * Finds the ViewProduct model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return ViewProduct the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = ViewProduct::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
echo $form->field( $model, 'catalog_id', [ 'template' => "{label}\n<div class='col-sm-10'>{input}\n{hint}\n{error}</div>", 'labelOptions' => ['class' => 'control-label col-sm-2'], 'inputOptions' => ['class' => 'form-control'], ] )->dropDownList(ArrayHelper::map(Catalogs::find()->all(), 'catalog_id', 'name'), ['prompt' => 'Выберите каталог ...']); ?> <?php echo $form->field($model, 'view_product_id', ['template' => "{label}\n<div class='col-sm-10'>{input}\n{hint}\n{error}</div>", 'labelOptions' => ['class' => 'control-label col-sm-2'], 'inputOptions' => ['class' => 'form-control']])->dropDownList(ArrayHelper::map(ViewProduct::find()->all(), 'view_product_id', 'name'), ['prompt' => 'Выберите вид номенклатуры ...']); ?> <?php echo $form->field($model, 'name', ['template' => "{label}\n<div class='col-sm-10'>{input}\n{hint}\n{error}</div>", 'labelOptions' => ['class' => 'control-label col-sm-2'], 'inputOptions' => ['class' => 'form-control', 'placeholder' => $model->name]])->textInput(); ?> <?php echo $form->field($model, 'precontent')->textarea(['rows' => 6, 'placeholder' => $model->precontent]); ?> <?php