[TYPO3-mvc] A way to allow multiple Plugins on the same page

Tim Schoch | GSTALTIG tim.schoch at gstaltig.ch
Thu Nov 17 13:46:36 CET 2011


Hello List

I found a simple workaround to allow multiple Plugin instances on the same page in combination with FlexForms switchableControllerActions.
It works in simple environments where *only one* plugin needs to change actions. (the rest will allways show the default action)
Basically I created an extenden RequestBuilder where I catch the «not allowed by this plugin» Exception.
In that case I redirect to the default action of the plugin set in the FlexForm.

You can find the PHP code here: http://pastebin.com/YrwWBuF0
and the TS code here: http://pastebin.com/Gn08KMN0

In our case we have one instance of the same plugin showing a list of   all multiform steps and an other instance displaying the form itself.

This method has its drawbacks of course, as it alters the behaviour for all extbase extensions.
(You could minimize this by placing the TypoScript directly on the page with your Plugin)
And it only allows one action to be changed at the time. It's not possible to show «fooAction» on plugin «A» and «barAction» on plugin «B».

But it has some advantages too (o'rly?) as you can exchange arguments easely. Haven't testet it, but probably you could even make the controller 
a singleton and use the same instance for all plugins. I've seen some threads on this topic but no solution yet - so I figured I'd post it.
Let me hear if this was helpfull for you.

Tim


More information about the TYPO3-project-typo3v4mvc mailing list