Commit c1b2020c authored by Carsten  Rose's avatar Carsten Rose
Browse files

Fixed rendering checkboxes: alignment of multicheckboxes was still buggy -...

Fixed rendering checkboxes: alignment of multicheckboxes was still buggy - multi in vertical and horizontal are ok now. The labels too.
AbstractBuildForm.php, Constants.php: The checkbox is now only wrapped in a <label> element in ALIGN_VERTICAL Mode. This is identical to the radio.
parent fcb12d24
......@@ -1056,8 +1056,6 @@ abstract class AbstractBuildForm {
* @return string
*/
public function buildCheckboxMulti(array $formElement, $htmlFormElementId, $attributeBase, $value, array $itemKey, array $itemValue) {
$orientation = '';
$br = '';
// Defines which of the checkboxes will be checked.
$values = explode(',', $value);
......@@ -1067,14 +1065,9 @@ abstract class AbstractBuildForm {
$html = $this->buildNativeHidden($htmlFormElementId, '');
if ($formElement['maxLength'] > 1) {
$orientation = 'checkbox-inline';
$checkboxClass = 'checkbox-inline';
} else {
$checkboxClass = 'checkbox';
}
// $orientation = (isset($formElement[CHECKBOX_ORIENTATION]) && $formElement[CHECKBOX_ORIENTATION] === 'vertical') ? '' : 'checkbox-inline';
$orientation = ($formElement['maxLength'] > 1) ? ALIGN_HORIZONTAL : ALIGN_VERTICAL;
$checkboxClass = ($orientation === ALIGN_HORIZONTAL) ? 'checkbox-inline' : 'checkbox';
$br = '';
$flagFirst = true;
for ($ii = 0, $jj = 1; $ii < count($itemKey); $ii++, $jj++) {
......@@ -1100,7 +1093,14 @@ abstract class AbstractBuildForm {
$htmlElement = '<input ' . $attribute . '>' . $value;
$htmlElement = Support::wrapTag("<label class='$orientation'>", $htmlElement, true);
// $htmlElement = Support::wrapTag("<label class='$orientation'>", $htmlElement, true);
// $htmlElement = Support::wrapTag("<label>", $htmlElement, true);
// With ALIGN_HORIZONTAL: the label causes some trouble: skip it
if (($orientation === ALIGN_VERTICAL)) {
$htmlElement = Support::wrapTag('<label>', $htmlElement);
}
$htmlElement = Support::wrapTag("<div class='$checkboxClass'>", $htmlElement, true);
if ($formElement['maxLength'] > 1) {
......@@ -1168,7 +1168,8 @@ abstract class AbstractBuildForm {
$jj = 0;
$flagFirst = true;
$radioClass = ($formElement['maxLength'] > 1) ? 'radio-inline' : 'radio';
$orientation = ($formElement['maxLength'] > 1) ? ALIGN_HORIZONTAL : ALIGN_VERTICAL;
$radioClass = ($orientation === ALIGN_HORIZONTAL) ? 'radio-inline' : 'radio';
$br = '';
$html = $this->buildNativeHidden($htmlFormElementId, $value);
......@@ -1193,11 +1194,10 @@ abstract class AbstractBuildForm {
$htmlElement = '<input ' . $attribute . '>' . $value;
// $element = Support::wrapTag('<label>',$element);
// if(isset($this->feDivClass[$formElement[FE_TYPE]]) && $this->feDivClass[$formElement[FE_TYPE]] != '') {
// $element = Support::wrapTag('<div class="' . $this->feDivClass[$formElement[FE_TYPE]] .'">', $element);
// }
// With ALIGN_HORIZONTAL: the label causes some trouble: skip it
if (($orientation === ALIGN_VERTICAL)) {
$htmlElement = Support::wrapTag('<label>', $htmlElement);
}
if ($formElement['maxLength'] > 1) {
......
......@@ -347,6 +347,9 @@ const CHECKBOX_VALUE_CHECKED = 'checked';
const CHECKBOX_VALUE_UNCHECKED = 'unchecked';
//const CHECKBOX_ORIENTATION = 'orientation';
const ALIGN_HORIZONTAL = 'horizontal';
const ALIGN_VERTICAL = 'vertical';
// Subrecord
const SUBRECORD_COLUMN_WIDTH = 20;
const FORM_ELEMENTS_NATIVE = 'native';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment