This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
developers:addons:core_events [2009/01/05 20:30] jonyo |
developers:addons:core_events [2014/09/25 16:55] (current) |
||
---|---|---|---|
Line 2: | Line 2: | ||
A core event is a way for an addon to interact with the base software to change or add something, without needing to make any changes to the base code at all. | A core event is a way for an addon to interact with the base software to change or add something, without needing to make any changes to the base code at all. | ||
+ | |||
+ | Note that core events are synonymous with //software hooks// with respect to the Geo software((All Core Events are software hooks, but not all software hooks are core events. | ||
===== How it Works ===== | ===== How it Works ===== | ||
- | Core events use [[http:// | + | Core events use [[http:// |
- | An addon will be automatically subscribed to a core event, if the core event' | + | An addon will be **automatically subscribed** to a core event, if 3 things happen: |
+ | * in **info.php**, | ||
+ | | ||
+ | * in the admin panel, at [[admin_menu/ | ||
In the base code, to //trigger a core event//, it will look something like this: | In the base code, to //trigger a core event//, it will look something like this: | ||
Line 16: | Line 21: | ||
**Breaking that call down:** | **Breaking that call down:** | ||
- | * trigger**Display**: | + | * trigger**Display**: |
* **event_name**: | * **event_name**: | ||
Line 33: | Line 38: | ||
| Notification | | Notification | ||
| Filter | | Filter | ||
- | | Overload | + | | Overload |
| Return a String | | Return a String | ||
| Return an Array | geoAddon:: | | Return an Array | geoAddon:: | ||
Line 41: | Line 46: | ||
===== Core Event Types based on What they Do ===== | ===== Core Event Types based on What they Do ===== | ||
- | STILL Working | + | |
+ | Most core events fall into one category or another based on what they are used for. Below is more details on each. | ||
+ | |||
+ | For more information on each individual core event, see the documentation in the example addon. | ||
+ | |||
+ | ==== filter ==== | ||
+ | |||
+ | The string to filter is passed in as $var to the addon. | ||
+ | |||
+ | A lot of the filter events are used to filter the results of a particular function, in those cases the name of the event is usually **filter_[CLASS NAME]_[FUNCTION NAME]**. | ||
+ | |||
+ | There is a special case where what is being filtered is another data type (like an array), this special case behavior was added in 4.1.0. | ||
+ | |||
+ | ==== overload ==== | ||
+ | |||
+ | Used to take over a particular task and skip the built-in functionality that would normally be done by the base code. Events | ||
+ | |||
+ | ==== notify ==== | ||
+ | |||
+ | This event type is to notify the addon of a certain //event//, to allow the addon to do things at a specific point. | ||
+ | |||
+ | ==== email ==== | ||
+ | |||
+ | This is a special case core event, it doesn' | ||
+ | |||
+ | Right now, this event is used as the only way that e-mails are sent by the software, through the use of the Send Mail Direct addon. | ||
+ | |||
+ | Something to be aware of for future versions: We plan to move the main mailing functionality to a base geoMail class in the future. | ||
+ | |||
+ | ==== auth ==== | ||
+ | |||
+ | Authorization core events. | ||
+ | |||
+ | ==== session ==== | ||
+ | |||
+ | These core events are to deal with the user session or session data. In all events so far, it is done in addition to, not instead of, the built in stuff. | ||
+ | |||
+ | These are what the Bridge addon uses to do its thing for syncing up login/ | ||
+ | |||
+ | ==== user ==== | ||
+ | |||
+ | These are for stuff dealing with things happening to a user, like registering a new user, editing a user's info, etc. | ||
+ | |||
+ | The applicable user info is passed in, and the return value is ignored. | ||
+ | |||
+ | ==== errorhandle ==== | ||
+ | |||
+ | This is a special case, this is the name of a core event that is its own category. | ||
+ | |||
+ | In the software, we use trigger_error() as a debugging message tool, the message syntax will match: | ||
+ | |||
+ | [ERROR|DEBUG] [TAG1[ TAG2...]]: Message | ||
+ | |||
+ | It can have any number of " | ||
+ | |||
+ | There are 2 addons included with the software that make use of this, one displays them on the page based on what " | ||
+ | |||
+ | ==== app_bottom ==== | ||
+ | |||
+ | This is another core event that is its own category. |