There's a knowledge base for one Joomla component and it contains a whole bunch of Plugin Events. Text files with a code, basically. I wonder how they can be used in a real life an what for? Would it really be helpful for PHP programmers to have access to those things as opposed to just working with that Joomla extension without them?
-
This question is very good, I like it. but invites highly general and opinion based answers. The answer also takes a higher level of understanding of applications/softwares. The Event/Plugin system of Joomla is a practical application of software architectural design and in my opinion one of the best practices of providing a standard possibility of custom modifications/extensibility of any complex application. Wordpress uses action hooks for the very similar purpose. But all of the other frameworks use something similar functional/structural design system for this: middleware, service provider– ZollieMay 22 at 6:24
-
But if you do not plan to let yourself or others to easily customize/modify your component at certain points of operations - without modifying the core codes - then you can create your component without implementing Events in them and it could still be a good workable custom component in your application.– ZollieMay 22 at 6:28
-
1^ a fair and welcoming response, Zollie. We'll have to get you some red jewellery at some point.– mickmackusa ♦May 22 at 6:49
-
Mick - We’ll have to find a good Event for that :) (when I’ll travel to Australia) :)– ZollieMay 22 at 7:10
-
1@Zollie As it is more of an opinion based question and there are two questions in the OP, surprised it got past the mods :), then I think your answer which more aimed at the second question, mine was for the first, then yours and anyone else's should have their own answer so people can vote along with the answers and comment on individually to further the overall discussion. The suspect OP is looking for individuals thoughts rather than a 'correct' answer to select.– IrataMay 24 at 1:07
1 Answer
As a 'real life' example I have built a series of Joomla components for a client who wanted a web interface, or portal, for his suppliers and clients to his windows server based accounting and stock control package to cut down on the phone calls and emails being fielded by his staff.
I use Events and Plugins extensively to manage the data moving back and forth between the Joomla components and his Windows Server, a sort of transport layer if you like. The thinking behind that is the Joomla components don't need to be altered when there are changes in the software running on the windows server, for example we are beginning to move from SOAP to REST API's, but the changes are happening in the plugins and the components are untouched.
There is a currently a 'Gateway' Plugin that all the other plugins use to Open and Close Sessions, it limits access during Server back ups overnight and attempts to recover itself and issue warnings when there are connectivity issues and it holds all the credentials for access.
The rest of the plugins are triggered by events such as Invoice/Order/Quote has been created/modified, stock level changed, stocktaking etc in the Joomla components that are then passing data to or from that component while it has no concept(ideally) of how or where the data is going or coming from. All of these plugins trigger the Gateway plugin to get their sessions established and closed, or blocked.
A future phase is to use the same events in the components with additional plugins that will pass the same data to the client's customers and suppliers own packages, eg. MYOB, Reckon, Xero, creating a B2B connection via the Joomla website to reduce telephone calls and manual re-entering. So more plugins but really no changes to the Joomla components.
Without plugins handling one or more external sources I couldn't really imagine how much more complicated it would be to create and manage that code if it was coded into each of the components at each step in the process.
This is a fairly niche example and I have full control of the environment, however in the case of 3rd party extensions with a user base of more than a few people the power of Events and Plugins really come to the fore if they have been implemented well, and not everything you see, included some of my own, falls into that category.
Events should allow your customer base to utilise your extension(s) in ways you may not have thought of or make connections to other extensions or services that would be a logistical nightmare for you to maintain for all the possible permutations there could be.