/** * Register the js scripts including the required assets and the options in * `$clientOptions` */ protected function registerScript() { $view = $this->getView(); if (isset($this->clientOptions['autocomplete_url'])) { if (class_exists('yii\\jui\\AutoComplete')) { \yii\jui\AutoComplete::register($view); } else { throw new InvalidConfigException('To use autocomplete functionality you need to install the ' . ' JUI Extension for Yii 2. ' . 'http://www.yiiframework.com/doc-2.0/ext-jui-index.html'); } } $clientOptions = empty($this->clientOptions) ? '' : Json::encode($this->clientOptions); JqueryTagsAsset::register($view); $view->registerJs("jQuery('#{$this->options["id"]}').tagsInput({$clientOptions});"); }