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...")
 
 
(2 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
When inventing a new settings page, it's required to add a permission and language identifier:
 
When inventing a new settings page, it's required to add a permission and language identifier:
  
'''Permission:'''
+
'''Permission (run in your install.php):'''
 
  Permissions::Add('settings_<rawname>');
 
  Permissions::Add('settings_<rawname>');
 
'''Language:'''
 
'''Language:'''
Line 21: Line 21:
 
?>
 
?>
 
</pre>
 
</pre>
 +
 +
 +
[[Category:Addons]]

Latest revision as of 17:02, 21 January 2019

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