Using Quanta hooks
Using hooks in a custom module, allows you to interact with the Quanta flow, adding your personal functionalities to common site routines (viewing a node, loading a page, submitting a form...), and changing the way they normally behave.
Before we start talking about it, be sure you are already familiar with the concept of hooking.
How to implement a hook in a custom Quanta module
Each module or class, can provide hook through the use of Environment's hook method.
So in example, running (anywhere in your module) the function $env->hook('checkfruits', $vars)
Will trigger a 'checkfruits' hook.
This means, other modules can then respond to the hook, and alter the objects passed by reference into $vars.
Common core hooks
There are several hooks already implemented in core modules, that you can use to interact with basic Quanta processes.
Some examples are:
Doctor:
hook_doctor_pre_setup
hook_doctor_DOCTORACTION (check, setup, etc.)
Cron:
hook_cron
Forms:
hook_form_validate
hook_form_FORMID_form_validate
hook_form_submit
hook_form_FORMID_form_submit
Lists:
hook_list_item
Language:
hook_fallback_language
Node:
hook_node_open
hook_node_load_cache
hook_node_load
hook_node_build
hook_node_presave
hook_node_save
hook_node_after_save
Page:
hook_page_init
hook_body_classes
hook_page_after_build
hook_page_complete
Qtags
hook_qtag_preload
hook_qtag
Shadow
hook_shadow_CONTEXTID_extra
User
hook_user_pre_validate
hook_user_validate
hook_user_load
hook_user_open
hook_user_save
hook_user_after_save