/** * Render the nestable list */ public function renderMenuItems() { $this->itemsProvider->items = $this->_nestedModels; parent::run(); }
/** * Register the client scripts */ public function registerClientScript() { $options = array(); if (isset($this->maxDepth)) { $options['maxDepth'] = $this->maxDepth; } if (isset($this->group)) { $options['group'] = $this->group; } $options = array_merge($options, $this->options); $jsOptions = CJavaScript::encode($options); $selector = '#' . $this->getId() . '_nestable'; $script = "jQuery('{$selector}').nestable({$jsOptions});"; $cs = Yii::app()->getClientScript(); if (!self::$_scriptsPublished) { $assets = Yii::app()->getModule('menubuilder')->getAssetsPath(); $cs->registerCssFile($assets . '/nestable.css'); if (!empty($this->cssFile)) { $cs->registerCssFile($this->cssFile); } else { $cs->registerCssFile($assets . '/menubuilder.css'); } $cs->registerCoreScript('jquery'); $cs->registerScriptFile($assets . '/jquery.nestable.js'); if ($this->useJson2) { $cs->registerScriptFile($assets . '/jquery.json-2.4.min.js'); } self::$_scriptsPublished = true; } $cs->registerScript('nestable_' . $this->getId(), $script); }