[BUGFIX] Do not render unused attribute in Checkbox element 74/59774/2
authorBenni Mack <benni@typo3.org>
Wed, 20 Feb 2019 22:54:57 +0000 (23:54 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Thu, 21 Feb 2019 10:45:19 +0000 (11:45 +0100)
Due to refactoring in FormEngine back in 2015, the Checkbox
Element renders " ... 1 ... " when a checkbox element is not
disabled.

To overcome this, the ternary operator is turned around,
returning an empty string when the element is not disabled.

Resolves: #87754
Releases: master, 9.5
Change-Id: Ic5fad1335fbdf1ed76523f598c20f66bfe195686
Reviewed-on: https://review.typo3.org/c/59774
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/backend/Classes/Form/Element/CheckboxElement.php

index ff81cd8..cde6d6a 100644 (file)
@@ -201,7 +201,7 @@ class CheckboxElement extends AbstractFormElement
                     value="1"
                     data-formengine-input-name="' . htmlspecialchars($additionalInformation['itemFormElName']) . '"
                     ' . $checkboxParameters . '
-                    ' . (!$disabled ?: ' disabled="disabled"') . '
+                    ' . ($disabled ? ' disabled="disabled"' : '') . '
                     id="' . $checkboxId . '" />
                 <label class="checkbox-label" for="' . $checkboxId . '">
                     <span class="checkbox-label-icon">