[TYPO3-english] Get info from another plugin
Stephan.Schuler at netlogix.de
Mon Feb 4 13:25:56 CET 2013
-----BEGIN PGP SIGNED MESSAGE-----
This cannot be solved in a general way, because there are some different scenarios that have to be handled separately.
Think about a plugin A and another plugin B. The execution order is A/B. This means if A changes something, B can respond to it. But if B changes something, A is already rendered.
You can of course switch both plugins in execution order (this depends on your global rendering mechanism, in temple voila I would just swap the XML nodes around), but this doesn't solve the problem completely because now you can make B change something and A respond to it, but B resond to A is broken now. So a general way is ... somehow different.
Now think about three plugins: A and B are just GUI, maybe a list view and a mini basket, in terms of a shopping system. Then you could introduce a third plugin as a worker plugin. A and B don't change anything, their order doesn't matter at all because they don't influence themselves. You just have to place a worker plugin (without any output) right in the top of your page that does whatever A and B would do.
This has two very important disadvantages.
The first is: You cannot put this approach on top of an existing plugin structure. If you have to deal with the existing tx_news or tt_news, they don't know about your "separated worker". So this doesn't work for foreign plugins out of the box but requires the whole application design to be made around this.
The second is: This is far away of separation of concerns. If we talk about a shopping system, you would need to implement the "remove from basket", "add to basket", "change quantity" and stuff like that in the "generalWorkerController", where it needs to be because of execution order, but where it doesn't really belong to as of module responsibility reasons.
So, I would suggest you not to find a general approach for real worker tasks. This always feels clumsy.
But, if we only talk about information handling: Use a common communication/information object that implements t3lib_Singleton.
Your first plugin calls objectManager->get('informationSingleton')->setSomething($foo).
The second plugin calls objectManager->get('informationSingleton')->getSomething().
Here the first plugin triggers the object creation. Because it's a singleton, the second plugin reuses the same object and your information is present right here.
Did this somehow help?
Telefon: +49 (911) 539909 - 0
E-Mail: Stephan.Schuler at netlogix.de
netlogix GmbH & Co. KG
IT-Services | IT-Training | Media
Andernacher Straße 53 | 90411 Nürnberg
Telefon: +49 (911) 539909 - 0 | Fax: +49 (911) 539909 - 99
E-Mail: info at netlogix.de | Internet: http://www.netlogix.de
netlogix GmbH & Co. KG ist eingetragen am Amtsgericht Nürnberg (HRA 13338)
Persönlich haftende Gesellschafterin: netlogix Verwaltungs GmbH (HRB 20634)
Umsatzsteuer-Identifikationsnummer: DE 233472254
Geschäftsführer: Stefan Buchta, Matthias Schmidt
- -----Ursprüngliche Nachricht-----
Von: typo3-english-bounces at lists.typo3.org [mailto:typo3-english-bounces at lists.typo3.org] Im Auftrag von Sergio
Gesendet: Montag, 4. Februar 2013 12:21
An: typo3-english at lists.typo3.org
Betreff: Re: [TYPO3-english] Get info from another plugin
Thanks Daniel for your approach. But I had thought of that: the problem is that extension is not tt_news. I just gave an easy example of extension, but this extension that is displaying the plugin in the main content area is not using any parameter in the url that can identify the "id of the product in the detail view" :-( _______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.typo3.org
Thanks Daniel for your approach. But I had thought of that: the problem is that extension is not tt_news. I just gave an easy example of extension, but this extension that is displaying the plugin in the main content a
-----BEGIN PGP SIGNATURE-----
Version: PGP Universal 3.3.0 (Build 8741)
-----END PGP SIGNATURE-----
More information about the TYPO3-english