Search code examples
typo3typoscripttx-news

useStdWrap conflicts with overrideFlexformSettingsIfEmpty in tx_news


In tx_news all plugin settings can also be set via TypoScript by adding their names to overrideFlexformSettingsIfEmpty. As the name suggests, these TS based settings are only used, if the corresponding Flexform fields of any plugin incarnation are left empty. This is what I want and what I need. It allows for a basic TS configuration that can be overwritten within each plugin element.

Now here's the problem:

As my TS default values need more complex calculations, I also activate useStdWrap for some of the tx_news settings fields. But I found that an active stdWrap will ALWAYS be used – no matter whether there are Flexform settings or not.

What I need is the possibility to use TS stdWrap to calculate default values, but if a Flexform setting is defined it should always override the TS settings (no matter how complex their calculation was and whether it included stdWrap operations).

Here is an example:

plugin.tx_news.settings {
    overrideFlexformSettingsIfEmpty := addToList(categories)
    useStdWrap := addToList(categories)

    categories.data = GP:cat
    categories.ifEmpty = 1
}

I would expect this TS to set the category of any news plugin from a query string parameter (cat) and fall back to category 1, but only if there are no categories set within the plugin itself.

But the stdWrap operations (.data and .ifEmpty) always kick in and there is no way to use the Flexform settings any more.

Is there a way to solve this?


Solution

  • There is no way to fix this for everybody because if it would be changed, there would be other drawbacks.

    One solution would be to use the hook $GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['Controller/NewsController.php']['overrideSettings'] where you can manipulate the settings in PHP having everything you need.