Task #57698

Adding two Plugins on Page not possible because one affects the other.

Added by Carsten Bleicker over 7 years ago. Updated over 7 years ago.

Status:
New
Priority:
Must have
Assignee:
-
Category:
-
Target version:
-
Start date:
2014-04-06
Due date:
% Done:

0%

Estimated time:

Description

Having two different controllers. Both having two actions.
- FooController->indexAction()
- BarController->indexAction()
- FooController->showAction()
- BarController->showAction()

Those are published by ts prototype wich are siblings of TYPO3.Neos:Plugin.
IndexAction having in their templates links to call the showAction().
Click on Link of FooController should only switch the Foo Plugin to showAction.
But both Foo- AND BarController switching to showAction.

Example code: https://gist.github.com/pumatertion/c8223b815b7b2b02132c

The generated URI of FooController Link looks like this:
dev.neos.local/example.html?--typo3_neos_nodetypes-page[%40package]=acme.foo&--typo3_neos_nodetypes-page[%40controller]=foo&--typo3_neos_nodetypes-page[%40action]=show

The generated URI of BarController Link looks like this:
dev.neos.local/example.html?--typo3_neos_nodetypes-page[%40package]=acme.foo&--typo3_neos_nodetypes-page[%40controller]=bar&--typo3_neos_nodetypes-page[%40action]=show


Files

#2

Updated by Christopher Hlubek over 7 years ago

Some thoughts when analyzing this:

The problem here is the "static" rendering of a Plugin without having a Node for it (but that is a perfectly fine use case). In that case the plugin namespace is taken from the Page node which is in the NodeTypes package. So the plugin namespace is the same for both Plugin object instances.

There is a way around that problem with the Page node by unsetting the node context variable and removing the ContentElementWrapping:

prototype(Acme.Foo:Foo) < prototype(TYPO3.Neos:Plugin) {
    package = 'Acme.Foo'
    controller = 'Foo'
    action = 'index'

    @override.node = ${null}
    @process.contentElementWrapping >
}

This will not use the node dependent Plugin configuration then. But with this definition the action cannot be switched, so the link to another action shows no effect.

When digging through the PluginImplementation code it gets obvious that action switching is only working for a node based Plugin. If no node context variable is given to the PluginImplementation the action is directly bound to the action TS property and won't be overridden by the request.

Also available in: Atom PDF