src/modules/Selection.php
public function init()
    {
        parent::init();

        foreach ($this->items as $value => $item) {
            if (is_string($item)) {
                throw new InvalidConfigException("Items cannot be of type string.");
            }
            $item['options'] = ['value' => $value];
        }
        if ($this->hasModel()) {
            $value = Html::getAttributeValue($this->model, $this->attribute);
            if (!empty($value)) {
                $defaultText = $value;
            }
        } else {
            if (!empty($this->value)) {
                $defaultText = $this->value;
            }
        }
        if (empty($defaultText)) {
            $defaultText = Yii::t('dosamigos/semantic/selection', 'Select...');
        }
        $this->defaultText = $this->encodeDefaultText ? Html::encode($defaultText) : $defaultText;
        Html::addCssClass($this->options, 'selection');
    }
public function init()
    {
        parent::init();

        foreach ($this->items as $value => $item) {
            if (is_string($item)) {
                throw new InvalidConfigException("Items cannot be of type string.");
            }
            $item['options'] = ['value' => $value];
        }
        if ($this->hasModel()) {
            $value = Html::getAttributeValue($this->model, $this->attribute);
            if (!empty($value)) {
                $defaultText = $value;
            }
        } else {
            if (!empty($this->value)) {
                $defaultText = $this->value;
            }
        }
        if (empty($defaultText)) {
            $defaultText = Yii::t('dosamigos/semantic/selection', 'Select...');
        }
        $this->defaultText = $this->encodeDefaultText ? Html::encode($defaultText) : $defaultText;
        Html::addCssClass($this->options, 'selection');
    }
Initializes the widget.
@throws \yii\base\InvalidConfigException