Plugin/Flexform fields for finisher overrides require the field to be defined in every concrete form configuration instead of falling back to the default value if the field is not set for the form
- I have a form configuration that uses a custom finisher without options. This works.
- I extended the finisher by a new option
- I registered the new option also at the FormEngine configuration
- I get a PHP warning in the Plugin flexform that has any form using this finisher selected:
Core: Error handler (BE): PHP Warning: Invalid argument supplied for foreach() in [...]/typo3/sysext/form/Classes/Hooks/DataStructureIdentifierHook.php line 223
The warning is thrown because the key
options in the finisher configuration in the concrete MyForm.form.yaml is not set (it had no options before, which is valid). It's conceptually wrong that this must be set. The Flexform value in the plugin should be rendered anyways and override the default value of the finisher in this case.
I expect that the override chain is
Flexform -> _optional_ Form value -> default from finisher
But currently it's actually
Flexform -> _mandatory_ Form value -> default from finisher.
This also has the implication that the default value of the finisher can never have any effect, because any concrete (overridable) form has to have an initial value anways.
Think of this scenario:
Someone has 100 (read: "a lot") Form configurations using a custom finisher. Now this finisher gets a new option with a reasonable default which should (not must!) be overridable in the Flexform. This person now has to edit all 100 Form configurations manually and add an initial value to every Form using this finisher even though the finisher has a default value itself which should actually be used.
Or in other words:
Extending a finisher with a new field should not invalidate the flexform of all forms using this finisher (but currently it does).
Or to state it in a more direct way:
The flexform in the plugin for the finisher overrides should simply show the overridable fields defined in the finisher (
finishersDefinition.FinisherKey.FormEngine.elements). Currently it wrongly shows only the intersection between
finishersDefinition.FinisherKey.FormEngine.elements and the options already set in the specific selected form (this has the ugly side effect that different forms can show different fields for the same finisher!). And if these options also happen to be empty (because the finisher was later extended by the new field witout adjusting all forms) the PHP warning is shown in addition.