diff options
author | Simon Rettberg | 2016-08-29 16:57:38 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-08-29 16:57:38 +0200 |
commit | 1ea14f191d4ddd51e2df8ea30e4e3ca24734d172 (patch) | |
tree | e4e484c0077ea5a1c4f9cc00049655232904be11 /modules-available/baseconfig/inc/baseconfigutil.inc.php | |
parent | make roomplanner 100% even on big screens and fix bug. (diff) | |
download | slx-admin-1ea14f191d4ddd51e2df8ea30e4e3ca24734d172.tar.gz slx-admin-1ea14f191d4ddd51e2df8ea30e4e3ca24734d172.tar.xz slx-admin-1ea14f191d4ddd51e2df8ea30e4e3ca24734d172.zip |
[baseconfig*] Fix translation hook to only consider the current module
Diffstat (limited to 'modules-available/baseconfig/inc/baseconfigutil.inc.php')
-rw-r--r-- | modules-available/baseconfig/inc/baseconfigutil.inc.php | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/modules-available/baseconfig/inc/baseconfigutil.inc.php b/modules-available/baseconfig/inc/baseconfigutil.inc.php index 75173ee6..3039ea12 100644 --- a/modules-available/baseconfig/inc/baseconfigutil.inc.php +++ b/modules-available/baseconfig/inc/baseconfigutil.inc.php @@ -13,12 +13,18 @@ class BaseConfigUtil * validator => xx, * ) * + * @param \Module $module optional, only consider given module, not all enabled modules * @return array all known config variables */ - public static function getVariables() + public static function getVariables($module = false) { $settings = array(); - foreach (glob('modules/*/baseconfig/settings.json', GLOB_NOSORT) as $file) { + if ($module === false) { + $module = '*'; + } else { + $module = $module->getIdentifier(); + } + foreach (glob("modules/{$module}/baseconfig/settings.json", GLOB_NOSORT) as $file) { $data = json_decode(file_get_contents($file), true); if (!is_array($data)) continue; @@ -31,10 +37,15 @@ class BaseConfigUtil return $settings; } - public static function getCategories() + public static function getCategories($module = false) { $categories = array(); - foreach (glob('modules/*/baseconfig/categories.json', GLOB_NOSORT) as $file) { + if ($module === false) { + $module = '*'; + } else { + $module = $module->getIdentifier(); + } + foreach (glob("modules/{$module}/baseconfig/categories.json", GLOB_NOSORT) as $file) { $data = json_decode(file_get_contents($file), true); if (!is_array($data)) continue; |