Difference between revisions of "Dev:Gateway:Config"
Line 1: | Line 1: | ||
+ | <div class="docs-alert-warning"> | ||
'''This is a required function''' | '''This is a required function''' | ||
+ | </div> | ||
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. | 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. |
Revision as of 12:23, 10 May 2014
This is a required function
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. These take the format below:
"settingname" => array(
"FriendlyName" => "Display Name",
"Type" => "xxxx",
// Additional attributes here
),
We'll look at all the possible setting field types and their supported attributes below. But first, let's take a look at an example of a typical configuration function for a gateway module.
function demogateway_config() {
return array(
"FriendlyName" => array(
"Type" => "System",
"Value" => "My Custom Gateway Module",
),
"accountnumber" => array(
"FriendlyName" => "Account Number",
"Type" => "text",
"Size" => "10",
"Description" => "<a href=\"#\">Click here to Signup</a>"
),
"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" => "Tick to enable",
),
);
}
The settings you define here will be passed into all the functions of your gateway module any time it is called. Please Note: we recommend avoiding generic names like "invoiceid" and "currency" which may conflict with other data WHMCS is passing to your gateway's functions.