protected function highlightErrorElement($key, $attributes)
    {
        $elClass = '';
        if (
            $this->validator instanceof ValidatorInterface &&
            $this->validator->hasError($key)
        ) {
            preg_match_all("#class='([^\s]+)'#", $this->attributes($attributes), $matches);
            $elClass = "class='".implode(' ', array_merge([$this->errorInputClass], $matches[1]))."'";
            unset($attributes['class']);
        }

        return [$elClass, $attributes];
    }