Dev:Gateway:Config
From WHMCS Documentation
Required
This is a required function by any type of module.
This is where you define the display name for your module, setup/usage instructions (if applicable) and any settings a user must configure for it.
There are 2 required system attributes - a Friendly Name - this is the name that is displayed to users of your module within the WHMCS interface, and the Usage Notes which allow you to provide additional instructions to users of your module.
Following those you can define an unlimited number of settings your module requires.
Field Definitions
Below are the supported configuration field types and their attributes.
Type | Required Attributes | Optional Attributes |
text | FriendlyName - Display Name Size - Length of Field |
Default - Default Value to Assign Description |
password | FriendlyName - Display Name Size - Length of Field |
Default - Default Value to Assign Description |
yesno | FriendlyName - Display Name | Default - true/false Description |
dropdown | FriendlyName - Display Name Options - Comma separated list of possible values |
Default - Option to select Description |
radio | FriendlyName - Display Name Options - Comma separated list of possible values |
Default - Option to select Description |
textarea | FriendlyName - Display Name | Default Cols - Number of columns Rows - Number of rows Description |
Code Sample
The settings you define here will be passed into all the functions of your gateway module any time it is called.
function demogateway_config() {
return array(
"FriendlyName" => array(
"Type" => "System",
"Value" => "My Custom Gateway Module",
),
"UsageNotes" => array(
"Type" => "System",
"Value" => "Don't have an account yet? <a href=\"#\">Click here to Signup</a>",
),
"accountnumber" => array(
"FriendlyName" => "Account Number",
"Type" => "text",
"Size" => "10",
"Description" => "This can be found in Profile > Account Information"
),
"apiusername" => array(
"FriendlyName" => "API Username",
"Type" => "text",
"Size" => "20",
),
"apipassword" => array(
"FriendlyName" => "API Password",
"Type" => "password",
"Size" => "20",
),
"testmode" => array(
"FriendlyName" => "Test Mode",
"Type" => "yesno",
"Default" => false,
"Description" => "Check to enable",
),
);
}