diff options
author | Simon Rettberg | 2018-02-13 12:22:35 +0100 |
---|---|---|
committer | Simon Rettberg | 2018-02-13 12:22:35 +0100 |
commit | 24d5f1b7fce386ca253506b710eea760a3ea6460 (patch) | |
tree | 5d78373c8387593ae5dd7b4f4523bcdda116a91b /modules-available/permissionmanager | |
parent | [translation] Add support for global translation plugins (diff) | |
download | slx-admin-24d5f1b7fce386ca253506b710eea760a3ea6460.tar.gz slx-admin-24d5f1b7fce386ca253506b710eea760a3ea6460.tar.xz slx-admin-24d5f1b7fce386ca253506b710eea760a3ea6460.zip |
[permissionmanager] Add global translation plugin
Diffstat (limited to 'modules-available/permissionmanager')
-rw-r--r-- | modules-available/permissionmanager/hooks/translation-global.inc.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/modules-available/permissionmanager/hooks/translation-global.inc.php b/modules-available/permissionmanager/hooks/translation-global.inc.php new file mode 100644 index 00000000..4810a719 --- /dev/null +++ b/modules-available/permissionmanager/hooks/translation-global.inc.php @@ -0,0 +1,38 @@ +<?php + +$HANDLER = array(); + +if (file_exists('modules/' . $moduleName . '/permissions/permissions.json')) { + + /** + * List of valid subsections + */ + $HANDLER['subsections'] = array( + 'permissions' + ); + + /* + * Handlers for the subsections that will return an array of expected tags. + * This is optional, if you don't want to define expected tags, don't create a function. + */ + + /** + * Configuration categories. + * + * @param \Module $module + * @return array + */ + $HANDLER['grep_permissions'] = function ($module) { + $file = 'modules/' . $module->getIdentifier() . '/permissions/permissions.json'; + if (!file_exists($file)) + return []; + $array = json_decode(file_get_contents($file), true); + if (!is_array($array)) + return []; + foreach ($array as &$entry) { + $entry = true; + } + return $array; + }; + +} |