miniCal
  • Quick Start
    • Introduction
  • miniCal Configuration
    • miniCal Hosted Service
    • Configure Feature Settings
    • Install Extensions
    • Create Multiple Properties
  • Local Installation
    • Local Installation
    • ENV Set-Up
    • Configuration Settings
    • Common Installations Errors
  • Contribution
    • Contribute to miniCal Core
  • Build an Extension
    • Build Your First Extension
      • Controllers
      • Assets
      • Config
      • language
      • Models
      • View
      • Helper
      • Library
      • Hooks
    • Open-source Extensions
    • Config Folder Files
      • Autoload File
      • Config File
      • Route File
    • miniCal Filters
    • miniCal Actions
    • Create Custom Hooks
    • Store Custom Data
      • POSTS
      • POSTMETA
      • OPTIONS
    • Composer Dependencies
  • Marketplace
    • miniCal Marketplace
  • Other resources
    • Overbooking for OTAs
    • miniCal Cron Setup
    • Automated Night Audit
    • Nginx Configuration
    • Docker Installation
    • Custom Domain Setup
  • Minical API Docs
    • API Documentation
  • Coming soon!
    • Access minical Data Using Helpers
      • Company Helper Functions
      • Customer Helper Functions
      • Booking Helper Functions
      • Rates Helper Functions
      • Rate Plan Helper Functions
      • Availability Helper Functions
      • Statement Helper Functions
      • Tax Helper Functions
      • Room Helper Functions
      • Charge Helper Functions
      • Payment Helper Functions
    • Access data in Extension
Powered by GitBook
On this page
  1. Build an Extension
  2. Build Your First Extension

Hooks

PreviousLibraryNextOpen-source Extensions

Last updated 3 years ago

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 .

//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;
}
miniCal Action list