public function run() { if ($this->hasModel()) { if (!ArrayHelper::getValue($this->options, 'id')) { $this->options['id'] = Html::getInputId($this->model, $this->attribute); } echo Html::activeTextarea($this->model, $this->attribute, $this->options); } else { if (!ArrayHelper::getValue($this->options, 'id')) { $this->options['id'] = Html::getAttributeName($this->name . rand(1, 9999)); } echo Html::textarea($this->name, $this->value, $this->options); } $this->registerAssets(); }