diff options
author | Simon Rettberg | 2016-05-17 18:14:13 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-05-17 18:14:13 +0200 |
commit | 8e729913a8f6258762f4e8049caebc9dbb42a71e (patch) | |
tree | 48b1d27787847c012994248e32f5a79695221218 /modules-available/baseconfig/inc/baseconfigutil.inc.php | |
parent | Get baseconfig ready for modularization (diff) | |
download | slx-admin-8e729913a8f6258762f4e8049caebc9dbb42a71e.tar.gz slx-admin-8e729913a8f6258762f4e8049caebc9dbb42a71e.tar.xz slx-admin-8e729913a8f6258762f4e8049caebc9dbb42a71e.zip |
Modularized baseconfig fetching (api)
Diffstat (limited to 'modules-available/baseconfig/inc/baseconfigutil.inc.php')
-rw-r--r-- | modules-available/baseconfig/inc/baseconfigutil.inc.php | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/modules-available/baseconfig/inc/baseconfigutil.inc.php b/modules-available/baseconfig/inc/baseconfigutil.inc.php index 33875156..ebaefbcf 100644 --- a/modules-available/baseconfig/inc/baseconfigutil.inc.php +++ b/modules-available/baseconfig/inc/baseconfigutil.inc.php @@ -20,9 +20,13 @@ class BaseConfigUtil $settings = array(); foreach (glob('modules/*/baseconfig/settings.json', GLOB_NOSORT) as $file) { $data = json_decode(file_get_contents($file), true); - if (is_array($data)) { - $settings += $data; + if (!is_array($data)) + continue; + preg_match('#^modules/([^/]+)/#', $file, $out); + foreach ($data as &$entry) { + $entry['module'] = $out[1]; } + $settings += $data; } return $settings; } @@ -32,11 +36,15 @@ class BaseConfigUtil $categories = array(); foreach (glob('modules/*/baseconfig/categories.json', GLOB_NOSORT) as $file) { $data = json_decode(file_get_contents($file), true); - if (is_array($data)) { - $categories += $data; + if (!is_array($data)) + continue; + preg_match('#^modules/([^/]+)/#', $file, $out); + foreach ($data as &$entry) { + $entry = array('module' => $out[1], 'sortpos' => $entry); } + $categories += $data; } return $categories; } -}
\ No newline at end of file +} |