# 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**](https://github.com/minical/minical/wiki/Autoload-file).

{% code title="autoload.php" %}

```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'
  );
```

{% endcode %}

**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**](https://github.com/minical/minical/wiki/Config-file).

{% code title="config.php" %}

```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" => ""
    
    );
```

{% endcode %}

**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.

{% code title="menu.php" %}

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

{% endcode %}

**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**](https://github.com/minical/minical/wiki/Route-File).

{% code title="route.php" %}

```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';
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.minical.io/build-an-extension/build-your-first-extension/config.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
