/** * Lists all models. */ public function actionIndex($menuId, $parentId = 0) { $menu = $this->loadMenuModel($menuId); $this->breadcrumbs = MenuItem::getBreadcrumbs($parentId, $menuId); $model = new MenuItem('search'); $model->unsetAttributes(); $model->menu_id = $menuId; $model->parent_id = $parentId; if (isset($_GET['MenuItem'])) { $model->attributes = $_GET['MenuItem']; } $this->render('index', array('model' => $model, 'menu' => $menu)); }
/** * Управление пунктами меню. * * @return void */ public function actionIndex() { $model = new MenuItem('search'); $model->unsetAttributes(); // clear any default values if (($data = Yii::app()->getRequest()->getParam('MenuItem')) !== null) { $model->setAttributes($data); } $this->render('index', ['model' => $model]); }