Addons:Setting

From GExtension Wiki
Jump to navigation Jump to search

Adding a page for the settings is similar to adding a normal page, but there is a difference in the first line. The first line must be:

<!--{"language":"<language-identifier>","icon":"<fontawesome-icon>","position":<position>}-->

Example:

<!--{"language":"general","icon":"fa-wrench","position":10}-->

Required Actions

When inventing a new settings page, it's required to add a permission and language identifier:

Permission (run in your install.php):

Permissions::Add('settings_<rawname>');

Language:

$language['perm_desc_settings_<rawname>'] = 'Access to <rawname> settings';

Security Check

To verify that the file was included by GExtension, it's required to include the following code after the first line:

<?php 
    if (!isset($G_MAIN) && !isset($G_REQUEST)) {
        die(json_encode(array("error" => "authentification failed")));
    }
?>