Developer Center

Settings/Configuration Page

The payment gateway module may have some settings that can be configured by the administrator.

For these settings, you must define a function named "config_fields" inside the class in the "SamplePaymentModule.php" file.

Configuration Fields

Supported configuration fields are:

  • Text
  • Password
  • Check Button
  • Dropdown Menu
  • Radio Button
  • Text Area

Below is an example configuration function showing each field type and the parameters available for the field types.

Example Source Code:

public function config_fields()
{
    return [
        'example1'          => [
            'name'              => "Text",
            'description'       => "Description for Text",
            'type'              => "text",
            'value'             => $this->config["settings"]["example1"] ?? '',
            'placeholder'       => "Example Placeholder",
        ],
        'example2'          => [
            'name'              => "Password",
            'description'       => "Description for Password",
            'type'              => "password",
            'value'             => $this->config["settings"]["example2"] ?? '',
            'placeholder'       => "Example Placeholder",
        ],
        'example3'          => [
            'name'              => "Approval Button",
            'description'       => "Description for Approval Button",
            'type'              => "approval",
            'value'             => 1,
            'checked'           => (boolean) (int) ($this->config["settings"]["example3"] ?? 0),
        ],
        'example4'          => [
            'name'              => "Dropdown Menu 1",
            'description'       => "Description for Dropdown Menu 1",
            'type'              => "dropdown",
            'options'           => "Option 1,Option 2,Option 3,Option 4",
            'value'             => $this->config["settings"]["example4"] ?? '',
        ],
        'example5'          => [
            'name'              => "Dropdown Menu 2",
            'description'       => "Description for Dropdown Menu 2",
            'type'              => "dropdown",
            'options'           => [
                'opt1'     => "Option 1",
                'opt2'     => "Option 2",
                'opt3'     => "Option 3",
                'opt4'     => "Option 4",
            ],
            'value'         => $this->config["settings"]["example5"] ?? '',
        ],
        'example6'          => [
            'name'              => "Radio Button 1",
            'description'       => "Description for Radio Button 1",
            'width'             => 40,
            'description_pos'   => 'L',
            'is_tooltip'        => true,
            'type'              => "radio",
            'options'           => "Option 1,Option 2,Option 3,Option 4",
            'value'             => $this->config["settings"]["example6"] ?? '',
        ],
        'example7'          => [
            'name'              => "Radio Button 2",
            'description'       => "Description for Radio Button 2",
            'description_pos'   => 'L',
            'is_tooltip'        => true,
            'type'              => "radio",
            'options'           => [
                'opt1'     => "Option 1",
                'opt2'     => "Option 2",
                'opt3'     => "Option 3",
                'opt4'     => "Option 4",
            ],
            'value'             => $this->config["settings"]["example7"] ?? '',
        ],
        'example8'          => [
            'name'              => "Text Area",
            'description'       => "Description for text area",
            'rows'              => "3",
            'type'              => "textarea",
            'value'             => $this->config["settings"]["example8"] ?? '',
            'placeholder'       => "Example placeholder",
        ]
    ];
}

The indices and properties of each field:

Name Type Explanation
name String Name of the field
description String Description of the field
dec_pos String Position of the statement. You can define 'L' if you want it to be displayed under the field name, and 'R' if you want it to be shown in the content of the field. (Default is 'R'.)
is_tooltip Boolean If the value "true" is set, a question mark will appear next to the field name, and when hovered over, the field's description will appear in the bubble.
type String The type of the field. Values it can take: (text, password, checkbox, dropdown, radio, textarea)
width Integer The form element width of the field. It is determined as a percentage. (Ex: 50)
wrap_width Integer Coverage width of the field. It is determined as a percentage. (Ex: 50)
placeholder String It uses the placeholder tag in the form element of the field.
value String Sets the default value of the field in the form element.
rows Integer Changes the number of lines in the form text field element of the field.
checked Boolean If the form element type of the field is "Checkbox Button", it determines the selected state.
options String,Array If the field's form element type is "Dropdown Menu" or "Radio Button", there are two different methods of defining options. Please review the sample source code.

You can use the code $this->config["settings"]["example1"] when you want to access the contents of the field saved in the config_fields function.

Module Structure Third Party Method

Do you have any questions?

Feel free to contact us
Contact Us
Copyright © 2024. All Rights Reserved.
Join Our Discord Channel
Top

New Year's Special Discount

"Startup Lifetime" and "Professional Lifetime" licenses are 30% off!

Coupon Code:
HAPPYYEARS30 Copied!
Discount Rate 30%
Expiration Date December 31, 2024