public function registerAssets() { $asset = new XEditableAsset(); if ($this->library) { $asset->library = $this->library; } $asset->register(Yii::$app->view); if ($this->pluginOptions['type'] === 'select2') { Select2Asset::register(Yii::$app->view); } }
public function registerClientScript() { $view = $this->getView(); $selector = '#' . $this->options['id']; $settings = Json::encode($this->settings); // Register asset $asset = Asset::register($view); if ($this->language !== null) { $asset->language = $this->language; } if ($this->bootstrap === true) { Select2BootstrapAsset::register($view); } else { Select2Asset::register($view); } // Init widget $view->registerJs("jQuery('{$selector}').select2({$settings});", $view::POS_READY, self::INLINE_JS_KEY . $this->options['id']); // Register events $this->registerEvents(); }