Ejemplo n.º 1
0
?>
">

            <?php 
BackendWidget::begin(['title' => Yii::t('app', 'Category'), 'icon' => 'tree', 'footer' => $this->blocks['submit']]);
?>

            <?php 
echo $form->field($model, 'active')->widget(\kartik\switchinput\SwitchInput::className());
?>

            <?php 
if ($model->parent_id == 0) {
    ?>
                <?php 
    echo $form->field($model, 'category_group_id')->dropDownList(\app\components\Helper::getModelMap(\app\modules\shop\models\CategoryGroup::className(), 'id', 'name'));
    ?>
            <?php 
}
?>

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

            <?php 
echo $form->field($model, 'title', ['copyFrom' => ["#category-name", "#category-h1", "#category-breadcrumbs_label"]]);
?>

            <?php 
echo $form->field(app\models\ViewObject::getByModel($model, true), 'view_id')->dropDownList(app\models\View::getAllAsArray());
 /**
  * Lists all CategoryGroup models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new SearchModel(['model' => CategoryGroup::className(), 'partialMatchAttributes' => ['name'], 'scenario' => 'default']);
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }