[TASK] Connect label with element in FormEngine
A single FormEngine element (created by "element" classes that typically extend AbstractFormElement) takes care of the "inner" HTML of an element. The surrounding "outer" HTML like embedding elements in palettes is created by "container" classes. Also, <label> tags for single elements are created by container classes, namely PaletteAndSingleContainer and FlexFormElementContainer. The situation having <label> done by a container and the inner HTML done by elements has drawbacks: First, "label" tags should have a "for" attribute, to connect it with input fields having "id" attribute. This is one of the accessibility "must haves". Separating label and fields in different classes does not allow doing this. Secondly, not all elements have such input or select tags at all. In those cases, the label is not a label, but should be a legend embedded in a fieldset. The patch moves the existing label tag generation from container classes to element classes: Only elements know if, how and where label and legend tags should be placed. The patch adds two helper methods to AbstractFormElement to simplify this, and connects the label tag with the input field in all elements or adds a fieldset with a legend. The v12 version of the patch needs to jump through some additional loops: When elements take care of label or legend, they signal this by setting the flag labelHasBeenHandled in the result array. The container then skips label creation to not have them twice. This is a b/w compat layer for not yet adapted custom elements in v12. The v13 version of the patch does not come with this fallback layer and documents needed custom element changes in a ReST file. Resolves: #97330 Releases: main, 12.4 Change-Id: Ia110eef5ec17aa4b7c731c3f82262b932d86958f Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/79517 Tested-by:core-ci <typo3@b13.com> Reviewed-by:
Michael Telgkamp <michael.telgkamp@mindscreen.de> Tested-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Michael Telgkamp <michael.telgkamp@mindscreen.de>
Showing
- Build/Sources/Sass/component/_form.scss 9 additions, 0 deletionsBuild/Sources/Sass/component/_form.scss
- Build/Sources/Sass/component/_root.scss 3 additions, 0 deletionsBuild/Sources/Sass/component/_root.scss
- typo3/sysext/backend/Classes/Form/Container/FlexFormElementContainer.php 16 additions, 12 deletions...ckend/Classes/Form/Container/FlexFormElementContainer.php
- typo3/sysext/backend/Classes/Form/Container/FlexFormEntryContainer.php 16 additions, 1 deletion...backend/Classes/Form/Container/FlexFormEntryContainer.php
- typo3/sysext/backend/Classes/Form/Container/PaletteAndSingleContainer.php 22 additions, 32 deletions...kend/Classes/Form/Container/PaletteAndSingleContainer.php
- typo3/sysext/backend/Classes/Form/Container/SingleFieldContainer.php 2 additions, 0 deletions...t/backend/Classes/Form/Container/SingleFieldContainer.php
- typo3/sysext/backend/Classes/Form/Element/AbstractFormElement.php 32 additions, 0 deletions...sext/backend/Classes/Form/Element/AbstractFormElement.php
- typo3/sysext/backend/Classes/Form/Element/BackendLayoutWizardElement.php 3 additions, 1 deletion...ckend/Classes/Form/Element/BackendLayoutWizardElement.php
- typo3/sysext/backend/Classes/Form/Element/CategoryElement.php 5 additions, 2 deletions...3/sysext/backend/Classes/Form/Element/CategoryElement.php
- typo3/sysext/backend/Classes/Form/Element/CheckboxElement.php 3 additions, 1 deletion...3/sysext/backend/Classes/Form/Element/CheckboxElement.php
- typo3/sysext/backend/Classes/Form/Element/CheckboxLabeledToggleElement.php 3 additions, 1 deletion...end/Classes/Form/Element/CheckboxLabeledToggleElement.php
- typo3/sysext/backend/Classes/Form/Element/CheckboxToggleElement.php 3 additions, 1 deletion...xt/backend/Classes/Form/Element/CheckboxToggleElement.php
- typo3/sysext/backend/Classes/Form/Element/ColorElement.php 7 additions, 3 deletionstypo3/sysext/backend/Classes/Form/Element/ColorElement.php
- typo3/sysext/backend/Classes/Form/Element/DatetimeElement.php 7 additions, 3 deletions...3/sysext/backend/Classes/Form/Element/DatetimeElement.php
- typo3/sysext/backend/Classes/Form/Element/EmailElement.php 7 additions, 3 deletionstypo3/sysext/backend/Classes/Form/Element/EmailElement.php
- typo3/sysext/backend/Classes/Form/Element/FileInfoElement.php 2 additions, 0 deletions...3/sysext/backend/Classes/Form/Element/FileInfoElement.php
- typo3/sysext/backend/Classes/Form/Element/FolderElement.php 6 additions, 2 deletionstypo3/sysext/backend/Classes/Form/Element/FolderElement.php
- typo3/sysext/backend/Classes/Form/Element/GroupElement.php 6 additions, 2 deletionstypo3/sysext/backend/Classes/Form/Element/GroupElement.php
- typo3/sysext/backend/Classes/Form/Element/ImageManipulationElement.php 3 additions, 1 deletion...backend/Classes/Form/Element/ImageManipulationElement.php
- typo3/sysext/backend/Classes/Form/Element/InputHiddenElement.php 2 additions, 2 deletions...ysext/backend/Classes/Form/Element/InputHiddenElement.php
Please register or sign in to comment