Project

General

Profile

Actions

Bug #98225

closed

Add class attribute to EXT:form form-tag results in exception

Added by Stefan Froemken about 2 years ago. Updated about 1 month ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
Start date:
2022-08-29
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Hello Form-Team,

I just try to add a css class to form-tag.

type: Form
identifier: newEvent
label: Create a new event
prototypeName: standard
renderingOptions:
  submitButtonLabel: Submit
properties:
  fluidAdditionalAttributes:
    class: withtip frame-indent
renderables:

In Form.html of EXT:form I have found that line:

additionalAttributes="{formvh:translateElementProperty(element: form, property: 'fluidAdditionalAttributes')}" 

So I was optimistic that it should work, but it results in:

(1/1) #1325697085 InvalidArgumentException
The options "properties" were not allowed (allowed were: "rendererClassName, renderingOptions, finishers, formEditor, label, variants")

Stefan

Actions #1

Updated by Stefan Froemken about 2 years ago

Argh, for form-tag the option "fluidAdditionalAttributes" is part of "renderingOptions". That's very confusing, as for all other elements this option is part of "properties". Have a look into the preview of all these search results. They all start with "properties.fluidAdditionalAttributes":

https://docs.typo3.org/c/typo3/cms-form/main/en-us/search.html?q=fluidAdditionalAttributes&check_keywords=yes&area=default

Maybe that should be updated somewhere in the documentation.

Actions #2

Updated by Garvin Hicking 5 months ago

  • Status changed from New to Needs Feedback

Do you have a suggestion on how to reword this and would like to make a PR? :-)

Actions #3

Updated by Gerrit Code Review 5 months ago

  • Status changed from Needs Feedback to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84727

Actions #4

Updated by Gerrit Code Review 5 months ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84727

Actions #5

Updated by Stefan Froemken 5 months ago

Hello. I have extracted the FormDefinition section of EXT:form documentation into its own documentation section as FormDefinition is IMO not part of a form element. Sure, both are extending the AbstractRenderable, but under the hood FormDefinition allows a completely different set of options.

FormElements:

ArrayUtility::assertAllArrayKeysAreValid(
    $options,
    ['label', 'defaultValue', 'properties', 'renderingOptions', 'validators', 'formEditor', 'variants']
);

Form:

ArrayUtility::assertAllArrayKeysAreValid(
    $options,
    ['rendererClassName', 'renderingOptions', 'finishers', 'formEditor', 'label', 'variants']
);

As you can see Form does not allow option properties.

While processing the fluidAdditionalAttributes there is a check to differ between it's a Form or FormElement. For FormElement the well known properties are used, but if it's a Form it internally switches to retrieve the properties from renderingOptions.

https://github.com/TYPO3/typo3/blob/main/typo3/sysext/form/Classes/Service/TranslationService.php#L269-L286

I have kept the header links to not damage the internal and external linking.

Actions #6

Updated by Gerrit Code Review 5 months ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84727

Actions #7

Updated by Gerrit Code Review 5 months ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84727

Actions #8

Updated by Gerrit Code Review 5 months ago

Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84727

Actions #9

Updated by Gerrit Code Review 5 months ago

Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84727

Actions #10

Updated by Gerrit Code Review 4 months ago

Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85454

Actions #11

Updated by Stefan Froemken 4 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #12

Updated by Benni Mack about 1 month ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF