Basics
Rules of engagement
MageHook is build with extensibility in mind. This will keep one of the focus points through time. The MageHook_Hook module serves as an extension base layer. PR's on new events will not be accepted. In order to build your own custom event you need to create a sub-module on top of the MageHook_Hook extension. The MageHook_Hook module will only provide you the required tools in order to dispatch events in a manageable way.
Sub module examples
As an example the Magento_Catalog will get extended with Magento_CatalogHookEvents for it's hook events. Please keep in mind in order to keep uniformity, it is important that you use the 'Hooks' affix.
Vendor_HookEventsCustomers
Vendor_HookEventsCatalog
Vendor_HookEventsCheckout
Vendor_HookEventsAdmin
Vendor_HookEventsIndexer
Type examples
Please read further through the documentation for more information about Types.
Vendor_HookTypeAmazonAlexa
Vendor_HookTypePusher
Vendor_HookTypeFacebook
Vendor_HookTypeGoogleHome
Vendor_HookTypeDeployer
Basic example
XML attributes
Title (options)
Title
Title (Purpose)
Group - Title
Group - Title (Purpose)
Service (optional)
A Service Contract is a set of PHP interfaces that are defined for a module . A service contract includes data interfaces, which preserve data integrity, and service interfaces, which hide business logic details from service requestors such as controllers, web services, and other modules. If developers define data and service interfaces according to a set of design patterns, the result is a well-defined, durable API that other modules and third-party extensions can implement through Magento models and resource models.
Click here for more information about Service Contracts
Converter (optional)
A converter can be used if data needs to be adjusted, checked or secured afterwards. The converter is injected after the optional Service Class. This makes it the final step before the given data is converted to a json body and forwarded to the Message Queue.
List (optional)
The list attribute gives a developer the option to hide the event from the adminhtml listing. By default the admin listing will use 'adminhtml' to search for events.
In the example above you can get a custom list of events specially defined for frontend users (a.k.a Customers or Guests).
In order to get a custom list, use the getList() method within the \MageHook\Hook\Helper\Events
Helper class.
Dispatch example
Last updated