Advanced Settings Class

Advanced Settings Class

 

The advanced settings class allows modules to add and/or remove settings from the Advanced Settings Page. Adding and Removing Advanced Settings is extremely easy.

 

 

First Steps

Inside any module simply add:

$freepbx_conf =& freepbx_conf::create();

Adding/Updating Settings Parameters and Initial Values

For each setting we want to add we will reset the $set variable and add an array of specific details for that setting

$set = array();

Value

Value of the setting (REQUIRED)

$set['value'] = false;

Default Value

Same as value (REQUIRED)

Name

Friendly Short Description (REQUIRED)

Description

Long Description for Tooltip (REQUIRED)

Category

Category of the setting (REQUIRED)

Type

type of setting. (REQUIRED)

Can be one of these values:

  • CONF_TYPE_BOOL (Boolean (true/false))

  • CONF_TYPE_INT (Integer Textbox)

  • CONF_TYPE_TEXT (Textbox)

  • CONF_TYPE_DIR (Directory Path Textbox)

  • CONF_TYPE_SELECT

  • CONF_TYPE_FSELECT

Options

Category of the setting (REQUIRED if using _SELECT or _FSELECT)

Read Only

Setting is Ready Only. default: false (OPTIONAL)

Hidden

Setting is Hidden. default: false (OPTIONAL)

Level

 Visual level of setting, value can be used again. default: 0 (OPTIONAL)

Module

module name that owns the setting and if the setting should only exist when the module is installed. If set, uninstalling the module will automatically remove this. (OPTIONAL)

Empty OK

If setting can be blank. default: true (OPTIONAL)

Add The Advanced Setting

Changing User Defined Values

The second parameter of set_conf_values is a boolean which determines if the value is committed to the database or set temporarily, if set to false you will need to run $freepbx_conf->commit_conf_settings()

Getting Values

Get The User Defined Value (Depreciated in FreePBX 12)

If the second parameter is true it forces the actual database variable to be fetched instead of the in-ram variable

Get Default Value from install time

Get The User Defined Value in FreePBX 12 (The old way still works)

If the second parameter is true it forces the actual database variable to be fetched instead of the in-ram variable

Return to Documentation Home I Return to Sangoma Support