/** * Widget based relations */ protected function getWidgetRelationModelQuery($className, $link = null, $options = []) { $link = !is_array($link) ? ['parent_id' => 'id'] : $link; $options['select'] = isset($options['select']) ? $options['select'] : ['id', 'parent_id', 'parent_type']; $options['with'] = array_merge(ArrayHelper::getValue($options, 'with', []), ['count', 'newCount']); $options['andWhere'] = isset($options['andWhere']) ? $options['andWhere'] : ['parent_type' => $this->isWhat()]; return $this->getRelationQuery($className, $link, $options); }
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); }