The TriggerHook event

by admin in Blog

During the process of improving e107 we wanted to create a way to hook into existing pages.

During the process of improving e107 we wanted to create a way to hook into existing pages.
We needed a way to let plugins hook into admin form screens, like create and edit pages of a news item for instance). Further, not only did we need form elements, also the handling of the save, update and delete statements needed to be addressed accordingly. We've developed the TriggerHook event for this purpose. If a plugin has this feature implemented, it allows for hooked-in events as described above.

A plugin that wants to add form elements to other plugins can do so by adding an e_event.php file in the root of the plugin folder.
This e_event.php file consists of a class with the naming convention 'e_event_myplugin' (in which myplugin is the name of your plugin). The class contains (a constructor and) four methods (form, create, update, delete) with the naming convention 'event_mymethod' (in which the mymethod is one of the four methods listed). Not all four methods are mandatory, but in most cases they should all be present.

The TriggerHook feature has already been implemented into several core parts. News, content, links_page, download and calendar_menu currently support it. So any plugin could potentially hook into any of those core parts!

There is currently one core implementation of the usage of the Triggerhook feature within a plugin: the new TagWords plugin.

While it made sense to implement the Triggerhook event feature into the tagwords plugin, other (new) plugins could use it just as well. Think about a geo plugin that lets you add longitude/latitude coordinates for each news item or content item just to name an example. Any plugin for that matter that wants to interact with other plugins could make use of it in a simple, clean and powerful way.


Social Links