Difference between revisions of "Addons:Setting"

From GExtension Wiki
Jump to navigation Jump to search
(Created page with "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: <pre><!--{"language":"<language-identif...")
 
Line 21: Line 21:
 
?>
 
?>
 
</pre>
 
</pre>
 +
 +
 +
[[Category:Addons]]

Revision as of 09:27, 21 May 2017

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