protected function processControlGroupOptions($model, $attribute, $options)
    {
        $errorOptions = TbArray::popValue('errorOptions', $options, array());
        $enableAjaxValidation = TbArray::popValue('enableAjaxValidation', $errorOptions, true);
        $enableClientValidation = TbArray::popValue('enableClientValidation', $errorOptions, true);
        $errorOptions['type'] = $this->helpType;
        $error = $this->error($model, $attribute, $errorOptions, $enableAjaxValidation, $enableClientValidation);
        // kind of a hack for ajax forms but this works for now.
        if (!empty($error) && strpos($error, 'display:none') === false) {
            $options['color'] = TbHtml::INPUT_COLOR_ERROR;
        }
        if (!$this->hideInlineErrors) {
            $options['error'] = $error;
        }
        $helpOptions = TbArray::popValue('helpOptions', $options, array());
        $helpOptions['type'] = $this->helpType;
        $options['helpOptions'] = $helpOptions;
        if (!TbArray::getValue('formLayout', $options, false)) {
            $options['formLayout'] = $this->layout;
        }
        $options['labelWidthClass'] = TbArray::getValue('labelWidthClass', $options, $this->labelWidthClass);
        $options['controlWidthClass'] = TbArray::getValue('controlWidthClass', $options, $this->controlWidthClass);
        return $options;
    }