diff --git a/extension/Classes/Core/Form/Checkbox.php b/extension/Classes/Core/Form/Checkbox.php index 724643ccc4128d92f9446c1a496079c6031af4af..8e8b92e2905fa0aac6bc3ea9ce7abcd17b73aec0 100644 --- a/extension/Classes/Core/Form/Checkbox.php +++ b/extension/Classes/Core/Form/Checkbox.php @@ -253,9 +253,10 @@ class Checkbox { $htmlElement = '<input ' . $attribute . '>' . $valueShow; - $checkboxLabelId = HelperFormElement::getCheckboxRadioOptionId($formElement[FE_HTML_ID], $ii, HTML_ID_EXTENSION_LABEL); - $html .= Support::wrapTag("<label class='" . $formElement[FE_BUTTON_CLASS] . "$classActive' id=\"$checkboxLabelId\">", - $htmlElement, true); + $labelAttribute = Support::doAttribute('title', $formElement[FE_TOOLTIP]); + $labelAttribute .= Support::doAttribute('class', $formElement[FE_BUTTON_CLASS] . $classActive); + $labelAttribute .= Support::doAttribute('id', HelperFormElement::getCheckboxRadioOptionId($formElement[FE_HTML_ID], $ii, HTML_ID_EXTENSION_LABEL)); + $html .= Support::wrapTag("<label $labelAttribute>", $htmlElement, true); $formElement[FE_TMP_CLASS_OPTION] = $labelBaseClass . $classActive; @@ -411,7 +412,7 @@ class Checkbox { public function buildCheckboxSingle(array $formElement, $htmlFormElementName, $attribute, $value, array &$json, $mode = FORM_LOAD) { // Bootstrap - $attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID]); + $attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID] . '-0'); $attribute .= Support::doAttribute('name', $htmlFormElementName); $attribute .= Support::doAttribute('value', $formElement[FE_CHECKBOX_CHECKED], false); $attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : ''); @@ -464,6 +465,7 @@ class Checkbox { if ($formElement[FE_BUTTON_CLASS] == '') { $formElement[FE_BUTTON_CLASS] = 'btn-default'; } + $formElement[FE_BUTTON_CLASS] = 'btn ' . $formElement[FE_BUTTON_CLASS]; if ($formElement[FE_MODE] == FE_MODE_READONLY) { $formElement[FE_BUTTON_CLASS] .= ' disabled'; @@ -471,7 +473,7 @@ class Checkbox { $classActive = ''; if ($formElement[FE_CHECKBOX_CHECKED] === $value) { - $classActive = ' active'; + $formElement[FE_BUTTON_CLASS] .= ' active'; } $htmlHidden = HelperFormElement::buildNativeHidden($htmlFormElementName, $formElement[FE_CHECKBOX_UNCHECKED]); @@ -486,10 +488,12 @@ class Checkbox { } $labelAttribute = Support::doAttribute('title', $formElement[FE_TOOLTIP]); - $labelAttribute .= Support::doAttribute('class', 'btn ' . $formElement[FE_BUTTON_CLASS] . $classActive); + $labelAttribute .= Support::doAttribute('class', $formElement[FE_BUTTON_CLASS]); + $labelAttribute .= Support::doAttribute('id', HelperFormElement::getCheckboxRadioOptionId($formElement[FE_HTML_ID], 0, HTML_ID_EXTENSION_LABEL)); $html .= Support::wrapTag("<label $labelAttribute>", $htmlElement, true); $html = Support::wrapTag('<div class="btn-group" data-toggle="buttons">', $html); + $formElement[FE_TMP_CLASS_OPTION] = $formElement[FE_BUTTON_CLASS]; $json = $this->getFormElementForJsonCheckbox($htmlFormElementName, $valueJson, $formElement); return $html; @@ -567,6 +571,8 @@ class Checkbox { $json[API_ELEMENT_UPDATE][$optionsId][API_ELEMENT_ATTRIBUTE] = $json[API_ELEMENT_UPDATE][$key][API_ELEMENT_ATTRIBUTE]; $json[API_ELEMENT_UPDATE][$optionsId][API_ELEMENT_ATTRIBUTE]['data-disabled'] = $json['disabled'] ? 'yes' : 'no'; $json[API_ELEMENT_UPDATE][$optionsId][API_ELEMENT_ATTRIBUTE]['data-required'] = $json['required'] ? 'yes' : 'no'; + $json[API_ELEMENT_UPDATE][$optionsId][API_ELEMENT_ATTRIBUTE]['disabled'] = $json['disabled'] ? 'disabled' : 'false'; + $json[API_ELEMENT_UPDATE][$optionsId][API_ELEMENT_ATTRIBUTE]['required'] = $json['required'] ? 'required' : 'false'; // Update label class (i.e.: 'qfq-disabled') of Checkbox/Radio (i.e. readonly on/off). if (isset($formElement[FE_TMP_CLASS_OPTION])) { @@ -633,13 +639,17 @@ class Checkbox { $labelAttribute = Support::doAttribute('title', $formElement[FE_TOOLTIP]); - $class = 'checkbox'; + $formElement[FE_BUTTON_CLASS] = 'checkbox'; if ($formElement[FE_MODE] == FE_MODE_READONLY) { - $class .= ' qfq-disabled'; // necessary for own style checkboxes to display them 'disabled' + $formElement[FE_BUTTON_CLASS] .= ' qfq-disabled'; // necessary for own style checkboxes to display them 'disabled' } - $html = Support::wrapTag("<label class='$class' $labelAttribute>", $html, true); -// $html = Support::wrapTag("<div class='checkbox'>", $html, true); + $formElement[FE_TMP_CLASS_OPTION] = $formElement[FE_BUTTON_CLASS]; + $labelAttribute = Support::doAttribute('title', $formElement[FE_TOOLTIP]); + $labelAttribute .= Support::doAttribute('class', $formElement[FE_BUTTON_CLASS]); + $labelAttribute .= Support::doAttribute('id', HelperFormElement::getCheckboxRadioOptionId($formElement[FE_HTML_ID], 0, HTML_ID_EXTENSION_LABEL)); + + $html = Support::wrapTag("<label $labelAttribute>", $html, true); $json = $this->getFormElementForJsonCheckBox($htmlFormElementName, $valueJson, $formElement);