Addons:Setting

From GExtension Wiki
Revision as of 09:27, 21 May 2017 by Ibot3 (talk | contribs)
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:

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")));
    }
?>