public static function controlGroup($type, $name, $value = '', $htmlOptions = array(), $data = array())
    {
        $color = TbArray::popValue('color', $htmlOptions);
        $groupOptions = TbArray::popValue('groupOptions', $htmlOptions, array());
        $controlOptions = TbArray::popValue('controlOptions', $htmlOptions, array());
        $label = TbArray::popValue('label', $htmlOptions);
        $labelOptions = TbArray::popValue('labelOptions', $htmlOptions, array());

        if (in_array($type, array(self::INPUT_TYPE_CHECKBOX, self::INPUT_TYPE_RADIOBUTTON))) {
            $htmlOptions['label'] = $label;
            $htmlOptions['labelOptions'] = $labelOptions;
            $label = false;
        }

        $help = TbArray::popValue('help', $htmlOptions, '');
        $helpOptions = TbArray::popValue('helpOptions', $htmlOptions, array());
        if (!empty($help)) {
            $help = self::inputHelp($help, $helpOptions);
        }

        $input = isset($htmlOptions['input'])
            ? $htmlOptions['input']
            : self::createInput($type, $name, $value, $htmlOptions, $data);

        self::addCssClass('control-group', $groupOptions);
        if (!empty($color)) {
            self::addCssClass($color, $groupOptions);
        }
        self::addCssClass('control-label', $labelOptions);
        $output = self::openTag('div', $groupOptions);
        if ($label !== false) {
            $output .= parent::label($label, $name, $labelOptions);
        }
        $output .= self::controls($input . $help, $controlOptions);
        $output .= '</div>';
        return $output;
    }
public static function controlGroup($type, $name, $value = '', $htmlOptions = array(), $data = array())
    {
        $color = TbArray::popValue('color', $htmlOptions);
        $groupOptions = TbArray::popValue('groupOptions', $htmlOptions, array());
        $controlOptions = TbArray::popValue('controlOptions', $htmlOptions, array());
        $label = TbArray::popValue('label', $htmlOptions);
        $labelOptions = TbArray::popValue('labelOptions', $htmlOptions, array());

        if (in_array($type, array(self::INPUT_TYPE_CHECKBOX, self::INPUT_TYPE_RADIOBUTTON))) {
            $htmlOptions['label'] = $label;
            $htmlOptions['labelOptions'] = $labelOptions;
            $label = false;
        }

        $help = TbArray::popValue('help', $htmlOptions, '');
        $helpOptions = TbArray::popValue('helpOptions', $htmlOptions, array());
        if (!empty($help)) {
            $help = self::inputHelp($help, $helpOptions);
        }

        $input = isset($htmlOptions['input'])
            ? $htmlOptions['input']
            : self::createInput($type, $name, $value, $htmlOptions, $data);

        self::addCssClass('control-group', $groupOptions);
        if (!empty($color)) {
            self::addCssClass($color, $groupOptions);
        }
        self::addCssClass('control-label', $labelOptions);
        $output = self::openTag('div', $groupOptions);
        if ($label !== false) {
            $output .= parent::label($label, $name, $labelOptions);
        }
        $output .= self::controls($input . $help, $controlOptions);
        $output .= '</div>';
        return $output;
    }
public static function controlGroup ( $ type , $ name , $ value = '' , $ htmlOptions = array ( ) , $ data = array ( ) ) { $ color = TbArray :: popValue ( 'color' , $ htmlOptions ) ; $ groupOptions = TbArray :: popValue ( 'groupOptions' , $ htmlOptions , array ( ) ) ; $ controlOptions = TbArray :: popValue ( 'controlOptions' , $ htmlOptions , array ( ) ) ; $ label = TbArray :: popValue ( 'label' , $ htmlOptions ) ; $ labelOptions = TbArray :: popValue ( 'labelOptions' , $ htmlOptions , array ( ) ) ; if ( in_array ( $ type , array ( self :: INPUT_TYPE_CHECKBOX , self :: INPUT_TYPE_RADIOBUTTON ) ) ) { $ htmlOptions [ 'label' ] = $ label ; $ htmlOptions [ 'labelOptions' ] = $ labelOptions ; $ label = false ; } $ help = TbArray :: popValue ( 'help' , $ htmlOptions , '' ) ; $ helpOptions = TbArray :: popValue ( 'helpOptions' , $ htmlOptions , array ( ) ) ; if ( ! empty ( $ help ) ) { $ help = self :: inputHelp ( $ help , $ helpOptions ) ; } $ input = isset ( $ htmlOptions [ 'input' ] ) ? $ htmlOptions [ 'input' ] : self :: createInput ( $ type , $ name , $ value , $ htmlOptions , $ data ) ; self :: addCssClass ( 'control-group' , $ groupOptions ) ; if ( ! empty ( $ color ) ) { self :: addCssClass ( $ color , $ groupOptions ) ; } self :: addCssClass ( 'control-label' , $ labelOptions ) ; $ output = self :: openTag ( 'div' , $ groupOptions ) ; if ( $ label !== false ) { $ output .= parent :: label ( $ label , $ name , $ labelOptions ) ; } $ output .= self :: controls ( $ input . $ help , $ controlOptions ) ; $ output .= '</div>' ; return $ output ; }
Generates a form control group.
@param string $type the input type.
@param string $name the input name.
@param string $value the input value.
@param array $htmlOptions additional HTML attributes.
@param array $data data for multiple select inputs.
@return string the generated control group.
Generates a form control group .