framework/widgets/ActiveField.php
protected function addErrorClassIfNeeded(&$options)
    {
        // Get proper attribute name when attribute name is tabular.
        $attributeName = Html::getAttributeName($this->attribute);

        if ($this->model->hasErrors($attributeName)) {
            Html::addCssClass($options, $this->form->errorCssClass);
        }
    }
protected function addErrorClassIfNeeded(&$options)
    {
        // Get proper attribute name when attribute name is tabular.
        $attributeName = Html::getAttributeName($this->attribute);

        if ($this->model->hasErrors($attributeName)) {
            Html::addCssClass($options, $this->form->errorCssClass);
        }
    }
Adds validation class to the input options if needed.
@param $options array input options
@since 2.0.14