private static function buildWrapper($field, $name, $label = '', $checkbox = false, $required)
        {
            $getter = 'get' . Inflector::camelize($name);
            $error = null;
            $actual = Session::instance('ThinForm')->getActual();

            if (null !== $actual) {
                $error = $actual->getErrors()->$getter();
            }

            $class = 'control-group';

            if (!empty(static::$controlGroupError) && !empty($error)) {
                $class .= ' ' . static::$controlGroupError;
            }

            $id = ' id="control-group-' . $name . '"';
            $out = '<div class="' . $class . '"' . $id . '>';
            $out .= static::buildLabel($name, $label, $required);
            $out .= '<div class="controls">' . PHP_EOL;
            $out .= ($checkbox === true) ? '<label class="checkbox">' : '';
            $out .= $field;

            if (!empty($error)) {
                $out .= '<span class="help-inline">' . $error . '</span>';
            }

            $out .= ($checkbox === true) ? '</label>' : '';
            $out .= '</div>';
            $out .= '</div>' . PHP_EOL;

            return $out;
        }
private static function buildWrapper($field, $name, $label = '', $checkbox = false, $required)
        {
            $getter = 'get' . Inflector::camelize($name);
            $error = null;
            $actual = Session::instance('ThinForm')->getActual();

            if (null !== $actual) {
                $error = $actual->getErrors()->$getter();
            }

            $class = 'control-group';

            if (!empty(static::$controlGroupError) && !empty($error)) {
                $class .= ' ' . static::$controlGroupError;
            }

            $id = ' id="control-group-' . $name . '"';
            $out = '<div class="' . $class . '"' . $id . '>';
            $out .= static::buildLabel($name, $label, $required);
            $out .= '<div class="controls">' . PHP_EOL;
            $out .= ($checkbox === true) ? '<label class="checkbox">' : '';
            $out .= $field;

            if (!empty($error)) {
                $out .= '<span class="help-inline">' . $error . '</span>';
            }

            $out .= ($checkbox === true) ? '</label>' : '';
            $out .= '</div>';
            $out .= '</div>' . PHP_EOL;

            return $out;
        }
private static function buildWrapper ( $ field , $ name , $ label = '' , $ checkbox = false , $ required ) { $ getter = 'get' . Inflector :: camelize ( $ name ) ; $ error = null ; $ actual = Session :: instance ( 'ThinForm' ) -> getActual ( ) ; if ( null !== $ actual ) { $ error = $ actual -> getErrors ( ) -> $ getter ( ) ; } $ class = 'control-group' ; if ( ! empty ( static :: $ controlGroupError ) && ! empty ( $ error ) ) { $ class .= ' ' . static :: $ controlGroupError ; } $ id = ' id="control-group-' . $ name . '"' ; $ out = '<div class="' . $ class . '"' . $ id . '>' ; $ out .= static :: buildLabel ( $ name , $ label , $ required ) ; $ out .= '<div class="controls">' . PHP_EOL ; $ out .= ( $ checkbox === true ) ? '<label class="checkbox">' : '' ; $ out .= $ field ; if ( ! empty ( $ error ) ) { $ out .= '<span class="help-inline">' . $ error . '</span>' ; } $ out .= ( $ checkbox === true ) ? '</label>' : '' ; $ out .= '</div>' ; $ out .= '</div>' . PHP_EOL ; return $ out ; }
Builds the Twitter Bootstrap control wrapper

@param string $field The html for the field
@param string $name The name of the field
@param string $label The label name
@param boolean $checkbox
@return string
Builds the Twitter Bootstrap control wrapper