Developer Center

Configuration Options

This function defines the settings that can be configured for your module on a product basis, the configuration options are divided into 2 functions.

1.) Thanks to the method you will use in the class, you can create configuration fields.

The name of this function should be config_options.

Supported configuration field types include below:

  • Text
  • Password
  • Confirmation Buttons
  • Drop-Down Menus
  • Circular (Radio) Select Buttons
  • Text Fields

Below are examples of available parameters for each field type.

public function config_options($data=[]){
    // $data --               Retrieves previously saved data.
    // Example              : echo isset($data["example1"]) ? $data["example1"] : NULL;
    // 'name'               : Name of the Configuration option
    // 'description'        : Description of the configuration option
    // 'type'               : Type of configuration optio
    // 'width'              : Width of configuration option, percent % (5,10,20,30,40,50,...100 vb)
    // 'rows'               : Number of lines of text field type
    // 'value'              : Default Value
    // 'placeholder'        : Value to appear if field is left blank
    // 'options'            : The value that should be defined in String or Array type
    // 'checked'            : Used to determine the status of approval box, true or false
    // 'is_tooltip'         : Shows the description information in balloon, true or false should be written
    // 'dec_pos'            : Determines the position of description information, type "L" to show under the name, type 'R' to show under the item

    return [
        'example1'          => [
            'name'              => "Text Box",
            'description'       => "Description for text box field",
            'type'              => "text",
            'width'             => "50",
            'value'             => "sample",
            'placeholder'       => "Sample placeholder",
        ],
        'example2'          => [
            'name'              => "Password Box",
            'description'       => "Description for password box field",
            'type'              => "password",
            'width'             => "50",
            'value'             => "sample",
            'placeholder'       => "Sample placeholder",
        ],
        'example3'          => [
            'name'              => "Confirm Button",
            'description'       => "Description for confirm button",
            'type'              => "approval",
            'checked'           => true,
        ],
        'example4'          => [
            'name'              => "Drop-down Menu 1",
            'description'       => "Description for Drop-down menu 1",
            'type'              => "dropdown",
            'options'           => "Option 1,Option 2,Option 3,Option 4",
            'value'             => "Option 2",
        ],
        'example5'          => [
            'name'              => "Drop-down Menu 2",
            'description'       => "Description for Drop-down menu 2",
            'type'              => "dropdown",
            'options'           => [
                'sec1'     => "Option 1",
                'sec2'     => "Option 2",
                'sec3'     => "Option 3",
                'sec4'     => "Option 4",
            ],
            'value'             => "sec2",
        ],
        'example6'          => [
            'name'              => "Circular (Radio) Button 1",
            'description'       => "Description for Circular (Radio) Button 1",
            'width'             => 40,
            'description_pos'   => 'L',
            'is_tooltip'        => true,
            'type'              => "radio",
            'options'           => "Option 1,Option 2,Option 3,Option 4",
            'value'             => "Option 2",
        ],
        'example7'          => [
            'name'              => "Circular (Radio) Button 2",
            'description'       => "Description for Circular (Radio) Button 2",
            'description_pos'   => 'L',
            'is_tooltip'        => true,
            'type'              => "radio",
            'options'           => [
                'sec1'     => "Option 1",
                'sec2'     => "Option 2",
                'sec3'     => "Option 3",
                'sec4'     => "Option 4",
            ],
            'value'             => "sec2",
        ],
        'example8'          => [
            'name'              => "Text Field",
            'description'       => "Description for Text Field",
            'rows'              => "3",
            'type'              => "textarea",
            'value'             => "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.",
            'placeholder'       => "Sample placeholder",
        ],
    ];
}

2.) You can optionally define the configuration fields by using (HTML & CSS & JS) codes in the output file.

For this function, you should edit pages/create-form-elements.php file.

Cases you need to know and pay attention to while editing are as follows;

  • Sample code content is available on the github repository.
  • While defining "name" attribute of form elements, you should define module_data[name of the configuration field including (letter, number, underscore)]
  • $module_data variable returns the value of configuration fields.
  • $module variable retrieves the content of your module class.
  • $LANG variable calls the language php file in lang/ directory located in the module whichever language is effective in administration panel interface, if it cannot find the language file, it uses en.php language file as default.
  • $product variable returns the line on the database of the product as array.
Getting Started Meta Data Parameters

Do you have any questions?

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