protected function getInitSelectionJs() { $customSelection = ""; if (isset($this->pluginEvents['afterSelect'])) { $customSelection = ArrayHelper::remove($this->pluginEvents, 'afterSelect'); } $js = "function (element, callback) {\n\t\t\t\tvar data = {id: element.val(), text: element.attr('title')\n\t\t\t};\n\t\t\tcallback(data);\n\t\t\t" . $customSelection . "\n\t\t}"; return new JsExpression($js); }