Developer Center

Module Configuration

You may need to make some configurations and adjustments before proceeding to add/edit the product phase in the module.

To reach the configuration page of the module you created navigate to "Admin Area > Services > Service Management > Module Setting > Your Module" page.

For displaying the configuration content, there should be a function called configuration in the class and return value should include string data type.

If the function is removed, the configuration contents will not be displayed.

Sample Function

public function configuration()
{
    $action             = isset($_GET["action"]) ? $_GET["action"] : false;
    $action             = Filter::letters_numbers($action);

    $vars = [
        'm_name'        => $this->_name,
        'area_link'     => $this->area_link,
        'lang'          => $this->lang,
        'config'        => $this->config,
    ];
    return $this->get_page("configuration".($action ? "-".$action : ''),$vars);
}

/*
 * Configuration with Form Elements -> Controller
*/
public function controller_save()
{
    $example1       = Filter::init("POST/example1","hclear");
    $example2       = Filter::init("POST/example2","password");
    $example3       = (int) Filter::init("POST/example3","numbers");

    $set_config     = $this->config;

    if($set_config["settings"]["example1"] != $example1) $set_config["settings"]["example1"] = $example1;
    if($set_config["settings"]["example2"] != $example2) $set_config["settings"]["example2"] = $example2;
    if($set_config["settings"]["example3"] != $example3) $set_config["settings"]["example3"] = $example3;

    if(Validation::isEmpty($example1))
    {
        echo Utility::jencode([
            'status' => "error",
            'message' => $this->lang["error1"],
        ]);
        return false;
    }

    $this->save_config($set_config);


    echo Utility::jencode([
        'status' => "successful",
        'message' => $this->lang["success1"],
    ]);

    return true;
}

In the function created for the configuration, the codes specified as examples are used to retrieve the content of "pages/configuration-*.php" file.

Configuration Files

  • pages/configuration.php  > is the main file of the configuration content.
  •  pages/configuration-form.php > Includes a form to set example for configuration content, controller_save function is used to save data coming from the form.
  • pages/configuration-list.php > Includes a listing to set example for configuration content.
Meta Data Parameters Product Configuration Options

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