Review main Merged

77885[FEATURE] Introduce ignoreFlexFormSettingsIfEmpty extbase configuration

Torben Hansen CR +2 V +2 Hard +648 −5 updated 03/20/23, 15:11

Commit message

Extbase extension settings defined in FlexForm always override settings
defined globally in TypoScript. This is a problem for FlexForm fields
which are empty, since an empty value will always override a possible
globally defined TypoScript setting. This behavior might be unwanted
and in case of EXT:felogin, it is currently not possible to define
various settings in TypoScript (e.g. redirect PIDs, storage PID and
more), since they are unintentionally overridden by FlexForm settings.

This patch introduces the new extbase TypoScript configuration
`ignoreFlexFormSettingsIfEmpty`, which allows extbase extensions
to define FlexForm settings, that will be ignored if empty.

Additionally, the new PSR-14 event
`BeforeFlexFormConfigurationOverrideEvent` is available for extension
authors, so a custom FlexForm override process can be implemented.

The new feature is now used in ext:felogin to prevent unwanted
overrides of globally defined TypoScript extension settings.

Review

  • Code review CR +2 Done
    • Nikita Hovratov +2
    • Georg Ringer +1
    • Alexander Schnitzler +1
    • Oliver Hader +1
  • Verified V +2 Done
    • Nikita Hovratov +2
    • Georg Ringer +1
    • Alexander Schnitzler +1
    • core-ci +1 CI

Issues 3

Files 7

Review log 2835

Show 710 earlier messages
  1. Torben Hansen uploaded patch set 1 02/17/23, 08:12

  2. core-ci voted on patch set 1 V +1 02/17/23, 08:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/37822

  3. Georg Ringer commented on patch set 1 02/17/23, 21:07

    i highly like this patch, however one important piece is missing in commit msg: overriding with an empty value can also be a desired behavior
  4. Torben Hansen uploaded patch set 2 V +1 02/18/23, 12:14

  5. Torben Hansen commented on patch set 2 02/18/23, 12:18

    Reply

    Updated the commit message and decided to use a different approach to introduce the feature
  6. core-ci voted on patch set 2 V +1 02/18/23, 12:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/37861

  7. Georg Ringer commented on patch set 2 02/19/23, 22:13

    Feature-99976-IntroduceignoreFlexFormSettingsIfEmptyExtbaseConfiguration.rst:15

    IMO integrators

    Feature-99976-IntroduceignoreFlexFormSettingsIfEmptyExtbaseConfiguration.rst:18

    as I invented this feature and had several issues with empty vs zero. IMO we should not treat 0 as empty but have no personal preference - however it must be included in a test case to know if we accidently change it

    Feature-99976-IntroduceignoreFlexFormSettingsIfEmptyExtbaseConfiguration.rst:26

    especially when a setting is set by the original extension and integrators *add* a value the not often used addToList should be mentioned as example. same for nested settings with a . in the name

    Feature-99976-IntroduceignoreFlexFormSettingsIfEmptyExtbaseConfiguration.rst:50

    not sure if this should be moved to an important rst or just be removed or kept
  8. Torben Hansen commented on patch set 2 02/22/23, 17:45

    Feature-99976-IntroduceignoreFlexFormSettingsIfEmptyExtbaseConfiguration.rst:15 Reply

    IMO this affects both target groups. Changed to text accordingly.

    Feature-99976-IntroduceignoreFlexFormSettingsIfEmptyExtbaseConfiguration.rst:18 Reply

    Changed to text. Actually `""` or `"0"` are considered as empty.

    Feature-99976-IntroduceignoreFlexFormSettingsIfEmptyExtbaseConfiguration.rst:26 Reply

    Done

    Feature-99976-IntroduceignoreFlexFormSettingsIfEmptyExtbaseConfiguration.rst:50 Reply

    I think it is good to keep the comment, since the new feature actually fixes the described problem.
  9. Torben Hansen uploaded patch set 3 V +1 02/22/23, 17:46

  10. core-ci voted on patch set 3 V +1 02/22/23, 17:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/37985

  1. Torben Hansen wrote 03/06/23, 08:25

    Topic set to extbase
  2. Alexander Schnitzler uploaded patch set 4 V +1 03/06/23, 08:37

  3. Alexander Schnitzler voted on patch set 4 V +1 CR +1 03/06/23, 08:38

  4. core-ci voted on patch set 4 V -1 03/06/23, 09:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38517

  5. Torben Hansen rebased onto patch set 5 CR +1 V +1 03/06/23, 09:09

  6. Alexander Schnitzler voted on patch set 5 V +1 CR +1 03/06/23, 09:09

  7. core-ci voted on patch set 5 V +1 03/06/23, 09:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38523

  8. Georg Ringer voted on patch set 5 V +1 CR +1 03/06/23, 09:43

  9. Nikita Hovratov commented on patch set 5 CR -1 03/06/23, 11:22

    on it
  10. Nikita Hovratov uploaded patch set 6 CR +1 V +1 03/06/23, 14:25

  11. core-ci voted on patch set 6 V +1 03/06/23, 14:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38550

  12. Nikita Hovratov voted on patch set 6 V +1 CR +1 03/06/23, 14:44

  13. Oliver Hader commented on patch set 6 03/06/23, 15:24

    FrontendConfigurationManagerTest.php:52

    From my POV, it would be fine to purge a setting, in case it's an empty string `''`. However, there might be scenarios, where zero `0` might be a valid (filled) value (e.g. `pid` allowing the root-page, `sys_language_uid` referring to the default language, `additionalFee` as an example which should be zero/disabled, ...). Thus, my suggestion is to consider values as filled if it's `0` - but only remove values in case they are blank `''` (or `null` in case we support `xsi:nil`).
  14. Torben Hansen commented on patch set 6 03/06/23, 15:35

    FrontendConfigurationManagerTest.php:52 Reply

    The `0` scenario is basically the one that makes most problems currently. In ext:felogin, the `settings.showForgotPassword` is a checkbox in FlexForm. Checkbox fields have a default value of `0` which leads to, that the TypoScript setting `settings.showForgotPassword` is never applied, if it is globally set to `1`. With the `ignoreFlexFormSettingsIfEmpty` feature, extension authors and integrators can control (opt-in feature), which FlexForm fields will be ignored (if empty or zero). So for fields, where the FlexForm `0` value scenario should be considered as valid, the corresponding settings-field should not be added to `ignoreFlexFormSettingsIfEmpty` setting.
  15. Georg Ringer commented on patch set 6 03/07/23, 05:58

    tested with ext:tt_address disabling custom method _injectConfigurationManager configuration only worked using "plugin.tx_ttaddress_listview" but not with "plugin.tx_ttaddress" is this by intention?
  16. Torben Hansen commented on patch set 6 03/07/23, 06:47

    Reply

    Actually, both should work, since this logic of merging TS plugin settings is resolved in `FrontendConfigurationManager` before the FlexForm configuration is applied. `FrontendConfigurationManager` fetches `plugin.tx_extensionname` first and then merges it together with `plugin.tx_extensionname_pluginname` (plugin configuration overrules extension configuration). The `ignoreFlexFormSettingsIfEmpty` configuration should therefore always be merged, regardless of whether it is defined on extension or plugin basis. I tested it with ext:felogin by renaming `plugin.tx_felogin_login` to `plugin.tx_felogin` and the flexform ignore feature worked as expected.
  17. Nikita Hovratov uploaded patch set 7 CR +1 V +1 03/07/23, 08:55

  18. Nikita Hovratov commented on patch set 7 03/07/23, 08:57

    Reply

    Added more testcases with mixed extension / plugin configuration. Still green.
  19. core-ci voted on patch set 7 V +1 03/07/23, 09:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38583

  20. Nikita Hovratov voted on patch set 7 V +1 CR +1 03/07/23, 09:08

  21. Georg Ringer voted on patch set 7 V +1 CR +1 03/07/23, 09:50

  22. Oliver Hader commented on patch set 7 CR +1 03/20/23, 09:14

    FrontendConfigurationManagerTest.php:52 Reply

    Thx for the explanation. Got it know 👍
  23. Alexander Schnitzler voted on patch set 7 V +1 CR +1 03/20/23, 13:10

  24. Nikita Hovratov voted on patch set 7 V +2 CR +2 03/20/23, 15:10

  25. Nikita Hovratov merged patch set 8 03/20/23, 15:11