Create Custom Hooks
Create New Actions/filters hooks
Custom hooks are created and called in the same way that miniCal Core hooks are.
To create a custom hook, use do_action() for Actions and apply_filters() for Filters.
To add a callback function to a custom hook, use add_action() for Actions and add_filter() for Filters.
Since any extension can create a custom hook, it’s important to prefix your hook names to avoid collisions with other extensions.
For example, the function extension_name_email_body_editor (where extension_name_ is a unique prefix for your extension) would avoid any collisions.
Extension Name: Custom Field (customfield)
If your extension adds a custom field to a form, you can use Actions to allow other extensions to add their own settings to it.
do_action( 'customfield_after_adding_field' );
Now another extension can register a callback function for the customfield_after_adding_field hook and inject new settings:
add_action( 'customfield_after_adding_field', 'callback_function' );
Extension Name: Custom Type (customtype)
In this example, when the new customer is registered, the parameters that define it are passed through a filter, so another extension can change them before the customer is created.
apply_filters( 'customtype_customer_type', $params )
add_filter( 'customtype_customer_type', 'callback_functionhp' );