public function init() { $this->model = new RepliesModel(['constrain' => ['type' => 'chat']]); $this->notificationModel = new \nitm\widgets\models\Notification(['constrain' => ['user_id' => \Yii::$app->user->getId()]]); $this->updateOptions = array_merge($this->_updateOptions, $this->updateOptions); parent::init(); Asset::register($this->getView()); }
public function init() { $this->model = $this->model instanceof RepliesModel ? $this->model : new RepliesModel(['constrain' => ['type' => 'notes']]); $this->model->maxLength = 140; $this->editorOptions = array_merge($this->defaultEditorOptions(), $this->editorOptions); $this->options = array_merge($this->defaultOptions(), $this->options); parent::init(); Asset::register($this->getView()); }
public function init() { switch (1) { case !$this->model instanceof RepliesModel && ($this->parentType == null || $this->parentId == null || $this->parentKey == null): $this->model = null; break; default: $this->model = $this->model instanceof RepliesModel ? $this->model : (new RepliesModel(['initSearchClass' => false]))->findModel([$this->parentId, $this->parentType, $this->parentKey]); break; } parent::init(); $this->options = array_merge($this->defaultOptions(), $this->options); $this->options['id'] .= $this->uniqid; Asset::register($this->getView()); }
public function init() { switch (1) { case !$this->model instanceof RepliesModel && ($this->parentType == null || $this->parentId == null || $this->parentKey == null): $this->model = null; break; default: $this->model = $this->model instanceof RepliesModel ? $this->model : RepliesModel::findModel([$this->parentId, $this->parentType, $this->parentKey]); break; } parent::init(); $this->uniqid = !$this->uniqid ? '-' . uniqid() : $this->uniqid; $this->options['id'] .= $this->uniqid; Asset::register($this->getView()); }