[TYPO3-mvc] passing value to another plugin (i.e. action not in the flow)

Peter Niederlag typo3-list at niekom.de
Fri Mar 25 22:08:55 CET 2011


Hello Christian,

Am 25.03.2011 21:25, schrieb christian oettinger:
> Hi Peter, thanks for helping!
[...]
> Let's forget about my request tries (that's probably wise...) and go
> back to standard (as seen below):
> Two Plugins are in one Controller (TrainingController). The first plugin
> (Plugin Name "Search", leading to searchboxAction) shows the searchbox
> form.

If I dont misinterpret your code you have two plugins and a bunch of 
controllers.

For GET/POST Params one plugin is using a namespace 
'tx_arztcme_trainings' and the other one 'tx_arztcme_search'. Is that 
correct?

Unfortunatly I can't tell you an easy way to map properties from one 
namespace to the other (however there could be one). On link/action 
viewhelpers it is easy to add arguments that are then added in the 
proper namespace. However If I get you right you want to trigger/feed 
two ("independent") instances of a plugin(or two different plugins) on 
one page with the same argument. Currently you use two different Plugins 
for that purpose.

Correct/Are you still with me? ;)

(1)
My adivce/suggestion would be: just use one(!) Plugin, as that eases 
quite a few things! Actually there is no real need for two different 
plugins in most cases!

If you only have one plugin you probably face two problems:
- one instance is restricted to certain controllers/actions but will 
just behave like the other instance -> use flexform and 
allowedControllerActions to restrict the Controller/Actions (so one will 
always show the searchbox)
- different templates for the same action in differnt instances -> 
either solve it by some view logis inside the fluid-template or use 
layoutVariant() [1].

That's what I would suggest or use myself!

(2)
The other solution/approach is to use a initializeFoobarAction() method 
for a foobarAction() and get your hands dirty in there by searching the 
argument (if nothing else works from raw $_GET/$_POST) and then 
adding/setting it like you already described via 
'$this->request->setArgument('searchword',$hereWeFiddledGetPost);

Since you seem to operate with one simple string value this solution 
probably could be reasonable for you.

hth and Greets,
Peter
-- 
Peter Niederlag
http://www.niekom.de * TYPO3 & EDV Dienstleistungen *


More information about the TYPO3-project-typo3v4mvc mailing list