public static function renderControl(\bootbuilder\Controls\Control $control, $return = false) { // Form group $html = "<div class='form-group"; if ($control->isErrorState() && self::$displayerrors) { $html .= " has-error"; } $html .= "'>"; // Label if (!$control instanceof \bootbuilder\Controls\Checkbox && !$control instanceof \bootbuilder\Controls\Radio) { $html .= "<label for='{$control->getId()}' class='control-label " . self::$labelcol . "'>" . $control->getLabel() . "</label>"; } else { $html .= "<label class='control-label " . self::$labelcol . "'></label>"; } // Control $html .= "<div class='" . self::$controlcol . "'>"; $html .= $control->renderBasic(); // HelpText if ($control->getHelpText() !== null && strlen($control->getHelpText()) > 0) { $html .= "<span class='help-block'>" . $control->getHelpText() . "</span>"; } $html .= "</div>"; // Close control div $html .= "</div>"; // Close form-group div return $html; }
/** * Render a form Control * @param \BootBuilder\Controls\Control $control the control to render * @param boolean $return Do you want to return the HTML? */ public static function renderControl(\bootbuilder\Controls\Control $control, $return = false) { return $control->renderBasic(); }