Hooks

Under the hooks folder, we have 2 files actions.php and filters.php

----->hooks
      |----->actions.php
      |----->filters.php

Actions

Action is one of the two types of hooks. They provide a way for running a function at a specific point in the execution of miniCal Core. Callback functions for an Action do not return anything to the calling Action hook. You can create a hook in the application/hooks folder, here we have created an actions.php file. You can find the list of actions here miniCal Action list.

//file name actions.php
// This is a core action that will be executed when a new reservation is created in miniCal
add_action('add.booking.created', 'your_callback_function_1', 10, 1);
function your_callback_function_1($data) {
    // code here
}


// This is a custom action and can be executed from this extension controllers.
add_action('my-custom-action', 'your_custom_callback_function', 10, 1);
function your_custom_callback_function($data) {
    // code here
}

Filters

They provide a way for functions to modify data during the execution of the miniCal Core. They are the counterpart to action. You can create a hook in the application/hooks folder, here we have created a filers.php file.

filters.php
// This is a custom action and can be executed from this extension controllers.
add_filter('my-custom-filter', 'your_callback_function_2', 10, 1);
function your_callback_function_2($data) {
    
    // start writing code here
    // return $data;
}

Last updated