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

Config

This folder has four files each file has its different work.

  • autoload.php

  • config.php

  • menu.php

  • route.php

autoload.php: This file load all the asset dependency in the controller. Make a config array and add all files to it, config array has a "file" key that has JS file location as value and a "location" key that has an array of locations("controller_name/method_name") as value(where this JS file going to load). Here is the detailed description of the autoload file.

autoload.php
<?PHP 
//load js file on controller function
$config['js-files'] = array(
    array(
        "file" => 'https://nightly.datatables.net/js/jquery.dataTables.js',
        "location" => array(
            "show_booking/show_latest_bookings",
            "show_booking/show_customer_list",      
            "custom_data/get_post_data",
            "option_data/get_option_data",
        ),
    ), 
    array(
        "file" => 'assets/js/booking_list.js',
        "location" => array(
            "show_booking/show_latest_bookings",
            "show_booking/show_customer_list", 
        ),
    ),
    array(
        "file" => 'assets/js/post_custom_data.js',
        "location" => array(
            "custom_data/get_post_data",
        ),
    ),
    array(
        "file" => 'assets/js/option_data.js',
        "location" => array(
            "option_data/get_option_data",
        ),
    )
);

//load css file for controller function
$config['css-files'] = array(
    array(
        "file" => 'assets/css/extension.css',
        "location" => array(
            "show_booking/show_latest_bookings",
            "show_booking/show_customer_list",
            "custom_data/get_post_data",
            "option_data/get_option_data",
            "sample_controller/index",
            "sample_controller/show_info_page",
        ),
    ),
    array(
        "file" => 'https://nightly.datatables.net/css/jquery.dataTables.css',
        "location" => array(
            "show_booking/show_latest_bookings",
            "show_booking/show_customer_list",
            "custom_data/get_post_data",
            "option_data/get_option_data",
         ),
    ),
);

//load helpers file 
$extension_helper = array(
    'booking_list_helper'
  );

config.php: This file has the config array containing the extension details such as name, description, or any information about it. 'is_default_active' key has 1 or 0. Here is the detailed description of the config file.

config.php
<?php 

$config = array(
        "name" => "Minical Extension Boilerplate",
        "description" => "It is a sample boilerplate extension it contains the basic structure of a typical extension. It will show you the list of bookings.",
        "is_default_active" => 1,
        "version" => "1.0.0", // version of extension
        "logo" => "", // extension's log image
        "view_link" => "sample_page", // view icon link
        "setting_link" => "sample_page", // setting icon link
        "categories" => array("payment_process"), // category of extension
        "marketplace_product_link" => ""
    
    );

menu.php: This file has menu-related details such as the extension's menu label, position on the menu bar, and route link. In this array, the 'location' key has a value such as PRIMARY, SECONDARY, and THIRD. 'label' key has menu label, 'link' key has URL link.

menu.php
<?php 
$module_menu = array(
	array(
		'label' => 'Bookings List',
		'location' => 'PRIMARY',
		'link' => 'bookings_list'
	)
);

route.php: This has an array of extension routes, the route will be defined as the same ci route. Here is the detailed description of the route file.

route.php
<?php

//sample page
    $extension_route['sample_page'] = 'sample_controller/index';

//list route    
    $extension_route['bookings_list'] = 'show_booking/show_latest_bookings';
    $extension_route['customer_list'] = 'show_booking/show_customer_list';

//post route
    $extension_route['post_data'] = 'custom_data/get_post_data';
    $extension_route['add_custom_data'] = 'custom_data/add_custom_data';
    $extension_route['edit_custom_data/(:any)'] = 'custom_data/edit_custom_data/$1';
    $extension_route['update_custom_data'] = 'custom_data/update_custom_data';
    $extension_route['delete_custom_data/(:any)'] = 'custom_data/delete_custom_data/$1';

//option route
    $extension_route['option_data'] = 'option_data/get_option_data';
    $extension_route['add_option_data'] = 'option_data/add_option_data';
    $extension_route['edit_option_data'] = 'option_data/edit_option_data';
    $extension_route['update_option_data'] = 'option_data/update_option_data';
    $extension_route['delete_option_data'] = 'option_data/delete_option_data';

//info route
    $extension_route['info_page'] = 'sample_controller/show_info_page';
PreviousAssetsNextlanguage

Last updated 3 years ago