Project

General

Profile

Actions

Bug #92363

closed

Epic #92636: felogin bug collection

Flexform always overwrites TS-Settings in Extbase-Version

Added by Harald Glaser over 3 years ago. Updated 7 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
felogin
Target version:
-
Start date:
2020-09-21
Due date:
% Done:

0%

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

Description

With the old pibase-version the flexform-values where only used when not empty (see FrontendLoginController->mergeflexFormValuesIntoConf), otherwise the values definied by typoscript where taken into account.

The new version always uses the values from flexform, as the fieldnames start with "settings." and - as far as I understand - Extbase automatically merges such fields with the typoscript plugin-settings, overriding the typoscript settings.

This is especially relevant for the fields on the redirect sheet of the flexform (the label for redirectMode still states that "TS or flexform" would be used even in the extbase version).

Example:
This works with the piBase-Version (used it already in 6.2, but works also in current 10.4.8) when leaving the related flexform field empty:

plugin.tx_felogin_pi1.redirectPageLogin = xxx

Whereas with the extbase version, this

plugin.tx_felogin_login.settings.redirectPageLogin = xxx

ends up with redirectPageLogin = '' (empty string) in the settings-array.

Do I miss a new way to set these values with typoscript?

If not, I guess there are two possible ways to allow the same behavior as with the pibase version:
a) renaming the fields in flexform, so that extbase doesn't merge them automatically, and use the logic in mergeflexFormValuesIntoConf of the pibase version
b) allowing something like "settings.override.xxx" and merging these values over flexform values before usage


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Feature #99976: Ignore empty flexform values in extbase extension settingsClosedTorben Hansen2023-02-17

Actions
Has duplicate TYPO3 Core - Bug #96921: Globally set storagePid get's overwrittenClosed2022-02-16

Actions
Actions #1

Updated by Sybille Peters over 3 years ago

ext:news has a good solution for this: overrideFlexformSettingsIfEmpty

Perhaps we can do something similar in the core.

Actions #2

Updated by Markus Klein over 3 years ago

  • Parent task set to #92636
Actions #3

Updated by Felix Nagel over 3 years ago

Another, related issue: there a quite a few TS constants which are never considered.

Actions #4

Updated by Jigal van Hemert over 3 years ago

Sybille Peters wrote in #note-1:

ext:news has a good solution for this: overrideFlexformSettingsIfEmpty

Perhaps we can do something similar in the core.

Maybe the FAL solution for the alt text, caption and title should be standard behaviour with flexform settings. overrideFlexformSettingIfEmpty has the disadvantage that you can clear those settings (which would be a problem for e.g.g redirects if you can't override the TS setting).

Actions #5

Updated by Stefan P over 2 years ago

Can confirm.

Actions #6

Updated by Robert Vock over 2 years ago

  • Has duplicate Bug #96921: Globally set storagePid get's overwritten added
Actions #7

Updated by Felix Nagel almost 2 years ago

TypoScript settings are still overridden by flexform in TYPO3 11.5.13.

Actions #8

Updated by Markus Klein over 1 year ago

Updating some technical information:

\TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager::overrideConfigurationFromFlexForm is the one doing "the work".

as noted above: empty flexform values override whatever is there from TypoScript.

While this is wanted/needed for some settings, this is not the case for all settings, e.g. pages/pids.
But maybe there is even a usecase for this with pages/pids.

$GLOBALS['TYPO3_CONF_VARS']['FE']['checkFeUserPid'] is a config worth to mention.
Set it to false to work around this problem completely and allow all pids.

Actions #9

Updated by Davide Alghi over 1 year ago

(T3-11)
One way to set via TypoScript is to remove the settings field from original flexform by overwriting the xml related to the tt_content.pi_flexform field
here an example
https://gist.github.com/einpraegsam/c16ba695a5e3d903c2a2f795d98bca71
In this way you can set different flexforms according to different conditions.
In my case, I needed to set the storage folders (pages) via TypoScript (by $constant), so I overwrote the FlexForm without the 'pages' field.
In my FlexForm, I removed 'settings.pages'
https://github.com/TYPO3/typo3/blob/ec00fb81a0f64050e37eb032fca7d28daaf6b3f8/typo3/sysext/felogin/Configuration/FlexForms/Login.xml#L46

Actions #10

Updated by Sybille Peters over 1 year ago

Do we have a general issue for combining Flexform and TypoScript? Because I think there are several problems when you want to combine TypoScript and Flexform and it is not just the problem described here.

Actions #11

Updated by Xavier Perseguers over 1 year ago

Yes we have a general issue for combining FlexForm and TypoScript.

I have the exact same problem with the login plugin since I switched to the Extbase-based version (instead of old pi1).

I want to dynamically configure the redirect after login and logout (redirectPageLogin and redirectPageLogout) but my TS is systematically overridden by the (empty) configuration coming from FlexForm, thus the plugin.

A solution that looks ok for that use case, but it would need extensive testing to ensure this has no side-effect would be to modify that line:

https://github.com/TYPO3/typo3/blob/main/typo3/sysext/extbase/Classes/Configuration/FrontendConfigurationManager.php#L339

that way:

- ArrayUtility::mergeRecursiveWithOverrule($frameworkConfiguration[$configurationPartName], $configuration[$configurationPartName]);
+ ArrayUtility::mergeRecursiveWithOverrule($frameworkConfiguration[$configurationPartName], $configuration[$configurationPartName], true, false);

For TYPO3 v10:

--- a/Classes/Configuration/FrontendConfigurationManager.bak.php    2022-12-05 15:29:19
+++ b/Classes/Configuration/FrontendConfigurationManager.php    2022-12-05 15:21:08
@@ -220,7 +220,7 @@
     {
         if (isset($configuration[$configurationPartName]) && is_array($configuration[$configurationPartName])) {
             if (isset($frameworkConfiguration[$configurationPartName]) && is_array($frameworkConfiguration[$configurationPartName])) {
-                ArrayUtility::mergeRecursiveWithOverrule($frameworkConfiguration[$configurationPartName], $configuration[$configurationPartName]);
+                ArrayUtility::mergeRecursiveWithOverrule($frameworkConfiguration[$configurationPartName], $configuration[$configurationPartName], true, false);
             } else {
                 $frameworkConfiguration[$configurationPartName] = $configuration[$configurationPartName];
             }
Actions #12

Updated by Lidia Demin over 1 year ago

Can confirm on TYPO3 11.5.21 (noticed it during an upgrade from 8.7. to 11.5). It seems that it also leads to some status messages not being shown anymore (empty).

Also, don't know if this relates, but in the piBase-Version it was possible to use the password change form for a logged-in user. This is not the case anymore. Instead, the user is redirected to the "redirectPageLogin" page when clicking on the link to the password change form.

Actions #13

Updated by Torben Hansen over 1 year ago

  • Related to Feature #99976: Ignore empty flexform values in extbase extension settings added
Actions #14

Updated by Torben Hansen over 1 year ago

Xavier Perseguers wrote in #note-11:

A solution that looks ok for that use case, but it would need extensive testing to ensure this has no side-effect would be to modify that line:

https://github.com/TYPO3/typo3/blob/main/typo3/sysext/extbase/Classes/Configuration/FrontendConfigurationManager.php#L339

that way:

[...]

For TYPO3 v10:

[...]

This does not work for me for boolean fields. If TypoScript has defined settings.showPermaLogin = 1 and FlexForm has no config for this setting (= empty), the result for the setting is settings.showPermaLogin = 0, since the empty checkbox is saved with a 0 value to FlexForm.

I am currently trying to come up with a configurable solution for the problem in general (see #99976).

Actions #15

Updated by Xavier Perseguers over 1 year ago

  • File before.png added
  • File after.png added
Actions #16

Updated by Xavier Perseguers over 1 year ago

  • File deleted (after.png)
Actions #17

Updated by Xavier Perseguers over 1 year ago

  • File deleted (before.png)
Actions #18

Updated by Torben Hansen about 1 year ago

For v10 and v11, this problem can sadly not be fixed. For v12, extbase extensions can now use the new setting ignoreFlexFormSettingsIfEmpty to define FlexForm field, which will be ignored if either empty or zero. See #99976 for details.

Actions #19

Updated by Torben Hansen 12 months ago

  • Status changed from New to Closed

Closing the issue, since it is fixed in v12 but can not be backported to v11.

Actions #20

Updated by Ernesto Baschny 7 months ago

FYI in case you reach this issue later on:

I created the "backport" for our own usage - since we need it in our projects as a bugfix. Feel free to use it in your v11 projects:

https://github.com/baschny/typo3/pull/1

Actions

Also available in: Atom PDF