Skip to content

Commit

Permalink
BUGFIX: Only show site switch command if there is more than one site
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebobo committed Jun 21, 2024
1 parent 4dae629 commit 1fbb7f2
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions Classes/Service/DataSource/CommandsDataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,26 @@ function (array $carry, array $submodule) {
return $carry;
}, []);

return [
'sites' => [
'name' => $this->translate('CommandDataSource.category.sites'),
'description' => $this->translate('CommandDataSource.category.sites.description'),
'icon' => 'file',
'subCommands' => $sitesForMenu,
],
$commands = [
'modules' => [
'name' => $this->translate('CommandDataSource.category.modules'),
'description' => $this->translate('CommandDataSource.category.modules.description'),
'icon' => 'puzzle-piece',
'subCommands' => $modulesForMenu,
],
]
];

// Only show site switch command if there is more than one site
if (count($sitesForMenu) > 1) {
$commands['sites'] = [
'name' => $this->translate('CommandDataSource.category.sites'),
'description' => $this->translate('CommandDataSource.category.sites.description'),
'icon' => 'file',
'subCommands' => $sitesForMenu,
];
}

return $commands;
}

protected function translate($id): string
Expand Down

0 comments on commit 1fbb7f2

Please sign in to comment.