Пример #1
0
/* @var $model \common\models\Category */
$query = \common\models\Category::find();
$data = $query->dataFancytree();
?>

<div class="category-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'parentId')->widget(FancytreeWidget::className(), ['source' => $data, 'clickFolderMode' => FancytreeWidget::CLICK_ACTIVATE_EXPAND]);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Пример #2
0
/* @var $model common\models\Product */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="product-form">

    <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'categories')->widget(FancytreeWidget::className(), ['source' => Category::find()->dataFancytree(), 'checkbox' => true, 'titlesTabbable' => true, 'clickFolderMode' => FancytreeWidget::CLICK_ACTIVATE_EXPAND]);
?>

    <?php 
echo $form->field($model, 'price')->textInput();
?>

    <?php 
echo $form->field($model, 'short_description')->textarea();
?>

    <?php 
echo $form->field($model, 'long_description')->textarea(['rows' => 6]);
?>

    <?php