Skip to content

Commit

Permalink
Fix apporder when an application has several menu items
Browse files Browse the repository at this point in the history
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc authored and susnux committed Nov 9, 2023
1 parent 5208282 commit 30fb835
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions apps/theming/lib/Listener/BeforePreferenceListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ public function handle(Event $event): void {
}

switch ($event->getAppId()) {
case Application::APP_ID: $this->handleThemingValues($event); break;
case 'core': $this->handleCoreValues($event); break;
case Application::APP_ID: $this->handleThemingValues($event);
break;
case 'core': $this->handleCoreValues($event);
break;
}
}

Expand Down Expand Up @@ -78,8 +80,8 @@ private function handleCoreValues(BeforePreferenceSetEvent|BeforePreferenceDelet

$value = json_decode($event->getConfigValue(), true, flags:JSON_THROW_ON_ERROR);
if (is_array(($value))) {
foreach ($value as $appName => $order) {
if (!$this->appManager->isEnabledForUser($appName) || !is_array($order) || empty($order) || !is_numeric($order[key($order)])) {
foreach ($value as $id => $info) {
if (!is_array($info) || empty($info) || !isset($info['app']) || !$this->appManager->isEnabledForUser($info['app']) || !is_numeric($info['order'] ?? '')) {
// Invalid config value, refuse the change
return;
}
Expand Down

0 comments on commit 30fb835

Please sign in to comment.