Available Since: v3.0 (September 2013)
Immediately before or after performing an action, you may want to accomplish something else. This can be as simple as logging that an object was changed or sending an email notification or applying complex business validations or modifications.
Note: When you implement one of these in your module, it MUST call the parent method of the same name.
Note: The permissions check for viewing or modifying an object are not performed until after the corresponding hook_pre method is complete. Therefore, you should never modify the database, send notifications, or display potentially sensitive information in those methods.
|Hook Name||Common Uses||Description|
|hook_preDelete||capture id’s for post delete cleanup||Executed before the
|hook_postDelete||remove child relationships||Executed if the
|hook_preLoad||??||Executed before the
|hook_postLoad||load child objects||Executed if the
|hook_preStore||set ownership, filter data||Executed before the
|hook_postStore||send email notifications, update child objects||Executed if the
|hook_preCreate||set date created & updated fields||Executed before the
|hook_postCreate||set or modify additional fields||Executed if the
|hook_preUpdate||set date updated||Executed before the
|hook_postUpdate||set or modify additional fields||Executed if the
Hooks are how we provide access to specific features and functionality in a standardized way. While no hooks are required in your custom module, they’re generally useful.
Available Since v3.0 (September 2013)
- Workflow Hooks (pre-create, post-create, pre-delete, post-delete, pre-load, post-load, pre-store, post-store, pre-update, post-update)
Available Since v1.1 (September 2009)
- Calendar Hook
- Cron Hook
- Search Hook