Think of the Magento Shop Event System. In some classes you'll find the Event Dispatcher, which dispatches a current event (say "customer_logged_in" (example, may not exist)) and with it, it'll ship the current context with it. (probably the class itself $this).
The event dispatcher iterates through configurated plugins/modules/extensions (whatever name you want to use) and executes their logic.
Pros
- multiple extensions can use the hook/xclass/event
- ...
Cons
- first come, first serve. Second in line will get already altered data. (Magento will allow you to specify dependencies in your modules configuration so you may be loaded before/after module XY)
Hook system
in External modules
Posted
Think of the Magento Shop Event System. In some classes you'll find the Event Dispatcher, which dispatches a current event (say "customer_logged_in" (example, may not exist)) and with it, it'll ship the current context with it. (probably the class itself $this).
The event dispatcher iterates through configurated plugins/modules/extensions (whatever name you want to use) and executes their logic.
Pros
- multiple extensions can use the hook/xclass/event
- ...
Cons
- first come, first serve. Second in line will get already altered data. (Magento will allow you to specify dependencies in your modules configuration so you may be loaded before/after module XY)
- ...