Yii2 autocomplete textarea

Hi, I just extended yii2-jui-AutoComplete widget to get an autocomplete-able textarea instead of a textbox, and I would like to share it… usage is pretty much the same as the normal autocomplete widget… sorry for my english… credit goes to the people that wrote the original components of this framework




<?php


namespace app\components\widgets;


use yii\helpers\Html;

use yii\jui\AutoComplete;


class AutoComTextarea extends AutoComplete

{

    /**

     * Renders the widget.

     */

    public function run()

    {

        echo $this->renderWidget();

        $this->registerWidget('autocomplete');

    }


    /**

     * Renders the AutoComplete widget.

     * @return string the rendering result.

     */

    public function renderWidget()

    {

        if ($this->hasModel()) {

            return Html::activeTextarea($this->model, $this->attribute, $this->options);

        } else {

            return Html::textarea($this->name, $this->value, $this->options);

        }

    }

}