aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2023-02-21 12:20:40 +0000
committerDavid Siegfried <david.siegfried@uni-vechta.de>2023-02-21 12:20:40 +0000
commitbb6445bf676b4a480fd050d482bab1238089fa5a (patch)
treeca6889ce17a5f0b8f41b036c9efcac1ab6faf824
parent14a9ec3cb7c6a4ec95e9b2c41137f990ac91bce8 (diff)
always provide default values, fixes #2203
Closes #2203 Merge request studip/studip!1435
-rw-r--r--app/controllers/profilemodules.php16
1 files changed, 7 insertions, 9 deletions
diff --git a/app/controllers/profilemodules.php b/app/controllers/profilemodules.php
index 607a798..201c4ff 100644
--- a/app/controllers/profilemodules.php
+++ b/app/controllers/profilemodules.php
@@ -54,16 +54,14 @@ class ProfileModulesController extends AuthenticatedController
private function getConfig()
{
- $config = $GLOBALS['user']->cfg->PLUS_SETTINGS;
- if (!$config || !isset($config['profile_plus'])) {
- return [
- 'view' => 'openall',
- 'displaystyle' => 'category',
- 'hidden' => [],
- ];
- }
+ $default = [
+ 'view' => 'openall',
+ 'displaystyle' => 'category',
+ 'hidden' => [],
+ ];
- return array_merge(['hidden' => []], $config['profile_plus']);
+ $config = $GLOBALS['user']->cfg->PLUS_SETTINGS;
+ return array_merge($default, $config['profile_plus'] ?? []);
}
private function storeConfig(array $config)