Bug #40674

Overwriting typoscript-settings by flexform-settings

Added by Simon Schick 9 months ago. Updated about 1 month ago.

Status:Rejected Start date:2012-09-06
Priority:-- undefined -- Due date:
Assignee:- % Done:

0%

Category:Extbase: Configuration
Target version:-
Has patch:No Tags:
Votes: 0

Description

Hi,

I got a rare edge-case where the flexform-setting did not overwrite the value set in typoscript - or to say it in other words .. there was no value directly set in typoscript ;)

Now to the example:
I have a plugin that sets the flexform-value { setttings: { categories: 10 } }.
In addition I define the following settings in TypoScript:

settings {
    categories.wrap = 15
}

What I would expect to get in the extension is { settings: { categories: { _typoScriptNodeValue: 10, wrap: 15 } } }
But what I get instead is: { settings: { categories: { wrap: 15 } } } saying that the flexform-value does not appear at all! When I remove the TypoScript I get my flexform-value.

I would really like to, but I was not experienced enough to write a test-case for that :(

If you want to use this in action, please install the extension "news".

AbstractConfigurationManager.patch (4.5 kB) Alexander Jahn, 2013-01-14 09:01

FrontendConfigurationManager.patch (1.7 kB) Alexander Jahn, 2013-01-14 09:01


Related issues

related to Core - Bug #21204: Question about class.t3lib_tceforms.php Needs Feedback 2009-10-08
duplicated by Extbase MVC Framework - Bug #43860: Error merging TypoScript Config Closed 2012-12-11

History

Updated by Alexander Schnitzler 6 months ago

  • Assignee set to Alexander Schnitzler
  • Target version set to Extbase 6.0

I will check this these days. Maybe we can fix that for 6.0, if not it will most probably be fixed in 6.1.

Updated by Alexander Schnitzler 5 months ago

  • Status changed from New to Accepted
  • Target version deleted (Extbase 6.0)

Updated by Alexander Jahn 4 months ago

I think i found and probably fixed the cause of the issue.
I wrote a function based on t3lib_div::array_merge_recursive_overrule() for merging typoscript configuration.

Please see attached patch.

There is, however, a problem with most tutorials on extbase floating around the internet. They suggest using "view =< plugin.tx_myplugin.view" etc. when adding a plugin to the page via typoscipt. Until now this simplay did nothing and was not needed in any way. Now this causes a problem as it destroys parts of the conf ( see comment in AbstractConfigurationManager patch).

Furthermore, I am not sure whether the class for merging TSconf should be here or in Tx_Extbase_Service_TypoScriptService instead.

Updated by Alexander Jahn 4 months ago

UPDATE: patch is against TYPO3 4.7.7

Updated by Tymoteusz Motylewski about 1 month ago

  • Assignee changed from Alexander Schnitzler to Tymoteusz Motylewski

Updated by Tymoteusz Motylewski about 1 month ago

an pseudocode example demonstrating a problem:

//extension level configuration
//normal TS
$tx_someextensionname = array(
    'settings.' => array(
        'foo' => 'bar',
        'some' => 'type',
        'some.' => array(
            'nested' => 'value'
        ),
        'some2.' => array(
            'nested2' => 'value2'
        )
    )
);
//Extbase TS
$tx_someextensionnameConverted = array(
    'settings' => array(
        'foo' => 'bar',
        'some' => array(
            '_typoScriptNodeValue' => 'type',
            'nested' => 'value'
        ),
        'some2' => array(
            'nested' => 'value'
        )
    )
);
//extension plugin scope

//normal TS
$tx_someextensionname_somepluginname. = array(
    'settings.' => array(
        'some.' => array(
            'nested' => 'valueOverridde',
            'new' => 'value'
        ),
        'some2' => 'type2'
    )
);
//extbase TS
$tx_someextensionname_somepluginnameConverted = array(
    'settings' => array(
        'some' => array(
            'nested' => 'valueOverridde',
            'new' => 'value'
        ),
        'some2' => 'type2'
    )
);

//results after merging extension and plugin scopes
// (the same error also occures when merging plugin and framework or plugin and flexforms configuration)

$expectedResult = array(
    'settings' => array(
        'foo' => 'bar',
        'some' => array(
            '_typoScriptNodeValue' => 'type',
            'nested' => 'valueOverridde',
            'new' => 'value'
        ),
        'some2' => array(
            '_typoScriptNodeValue' => 'type',
            'nested' => 'value'
        )
    )
);

//the "type" node is missing in some2 array, but it's preserved in the "some" array
$actualResult = array(
    'settings' => array(
        'foo' => 'bar',
        'some' => array(
            '_typoScriptNodeValue' => 'type',
            'nested' => 'valueOverridde',
            'new' => 'value'
        ),
        'some2' => array(
            'nested' => 'value'
        )
    )
);

Updated by Tymoteusz Motylewski about 1 month ago

The final TS configuration is a result of merging the
Extbase (global) TS
extension scope TS
plugin scope TS
flexforms config

Right now, if we want to have _typoscriptNodeValue in the final TS, then the node has to be an array already on the upper level.

It would be nice to get an example of a real life problem with the current behavior.

Updated by Marc Bastian Heinrichs about 1 month ago

  • Status changed from Accepted to Rejected
  • Assignee deleted (Tymoteusz Motylewski)
  • Priority changed from Should have to -- undefined --

This is an intended behaviour.

In extbase the typoscript dot notation is converted in a plain array structure without dots.

This means, if you have a settings option with subsettings , e.g.

settings {
  foo = 42
  foo {
    bar = Hello world!
  }
}

the top level setting

foo = 42

is not available via public api.

It is only saved internally in the subsettings key "_typoScriptNodeValue"

settings => array(
  foo => array(
    _typoScriptNodeValue = 42
    bar = Hello world!
  )
)

So it's not intended to overwrite the toplevel setting.

Recommended usage without a toplevel setting, which has subsettings:

Typoscript

settings {
    anothersettings = hello world
    categories.wrap = 15
}

Flexform:

settings {
    categories.uids = 10
}

Merged:

settings => array(
   anothersettings = hello world,
   categories => array(
     wrap = 15
     uids = 10
   )
)

Updated by Simon Schick about 1 month ago

Marc Bastian Heinrichs wrote:

This is an intended behaviour.

In extbase the typoscript dot notation is converted in a plain array structure without dots.

This means, if you have a settings option with subsettings , e.g. [...]

the top level setting [...] is not available via public api.

It is only saved internally in the subsettings key "_typoScriptNodeValue" [...]

So it's not intended to overwrite the toplevel setting.

Have you changed something here in the last 7 months?
That time, there was a _typoScriptNodeValue as well ... it just was not fully implemented.

Recommended usage without a toplevel setting, which has subsettings:

Typoscript [...]

Flexform: [...]

Merged: [...]

Would you also write it like this if categories is documented as stdWrap function?

Also available in: Atom PDF