From 1fbb7f2857f469803d7c30191cdd9ca7150835e8 Mon Sep 17 00:00:00 2001 From: Sebastian Helzle Date: Fri, 21 Jun 2024 09:04:06 +0200 Subject: [PATCH] BUGFIX: Only show site switch command if there is more than one site --- .../Service/DataSource/CommandsDataSource.php | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Classes/Service/DataSource/CommandsDataSource.php b/Classes/Service/DataSource/CommandsDataSource.php index 280687e..4b0411b 100644 --- a/Classes/Service/DataSource/CommandsDataSource.php +++ b/Classes/Service/DataSource/CommandsDataSource.php @@ -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