Feature #61649
closedExtbase settings merging (TS + FlexForm) should respect ".override" and ".ifEmpty" in FlexForms
0%
Description
I was just trying around how one could make a "default" TypoScript configuration for an Extbase-Plugin and being able to easily override settings from FlexForm.
One example:
we have the plugin in TypoScript:
- setting the "global" storagePid as default
tx_testpluginpi1 {
persistence {
storagePid = {$plugin.testpluginpi1.persistence.storagePid}
}
}
In FlexForm we could use something like this:
<persistence.storagePid.ifEmpty>
<TCEforms>
<label>StoragePid</label>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>pages</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>0</minitems>
<show_thumbs>1</show_thumbs>
<wizards>
<suggest>
<type>suggest</type>
</suggest>
</wizards>
</config>
</TCEforms>
</persistence.storagePid.ifEmpty>
Usually one would use the key-name "persistence.storagePid" - which will definitely will override the TypoScript setting even if empty/unset!
Currently the FlexForm code above works fine - but is ALWAYS overriding the TypoScript setting "persistence.storagePid". But it works - which indicates, that the stdWrap seems to be already present there!
I think there's somewhere missing the "current" value set in PHP for the processing of the FlexForm values.
The solution mentioned above appending ".ifEmpty" is compliant as one knows this usage from TypoScript which makes this solution very handy!
Is there any chance to change this? If I'll get a hint where to find the right place I'll make a fix/patch for it, too.
Updated by Petra Arentzen over 9 years ago
I also wish this would be changed.
But after a look in the code (FrontendConfigurationManager::overrideStoragePidIfStartingPointIsSet()) I think the way to set persistence settings individually for a specific content element should be using the "Page"- and the "Recursive"-Field in Content-Record.
Nevertheless the problem for overriding other settings resists but can be solved by using another flexform field name eg. settings.flexform.xxx, which then can be manually merged with settings.xxx from typoscript - only if they're not empty.
Updated by Daniel Goerz almost 9 years ago
- Tracker changed from Bug to Feature
- Priority changed from Should have to Could have
Updated by Torben Hansen over 1 year ago
- Related to Feature #99976: Ignore empty flexform values in extbase extension settings added
Updated by Stefan Froemken about 1 year ago
- Status changed from New to Closed
Hello,
Thanks for your info. Using TypoScript syntax in FlexForm is not the way to go. I found a pretty cool website describing how extbase determines the storagePid: https://www.derhansen.de/2016/02/how-extbase-determines-storagepid.html
In your case:
Please define a fallback storagePid in:
plugin.tx_myext.persistence.storagePid = 12,54,124
An editor still can set another storagePid (override) in extbase plugin itself. If he leaves the value empty (ifEmpty) your fallback from above takes effect.
If you feel this is the wrong decision, let me know, and I will re-open it.
Stefan