diff --git a/src/Config.php b/src/Config.php index 63254241cfc..51fe320971d 100644 --- a/src/Config.php +++ b/src/Config.php @@ -1499,7 +1499,7 @@ function formatGlobalLayout(layout) { 'value' => $data['default_dashboard_mini_ticket'], 'display_emptychoice' => true, 'context' => 'mini_core', - ]); + ], true); echo ""; } diff --git a/src/Dashboard/Grid.php b/src/Dashboard/Grid.php index ca0dc8ff22c..36674666f9b 100644 --- a/src/Dashboard/Grid.php +++ b/src/Dashboard/Grid.php @@ -1458,6 +1458,11 @@ public static function getDefaultDashboardForMenu(string $menu = "", bool $stric $config_key = 'default_dashboard_' . $menu; $default = $_SESSION["glpi$config_key"] ?? ""; if (strlen($default)) { + // If default is "disabled", return empty string and skip default value from config + if ($default == 'disabled') { + return ""; + } + $dasboard = new Dashboard($default); if ($dasboard->load() && $dasboard->canViewCurrent()) { @@ -1488,7 +1493,7 @@ public static function getDefaultDashboardForMenu(string $menu = "", bool $stric } - public static function dropdownDashboard(string $name = "", array $params = []): string + public static function dropdownDashboard(string $name = "", array $params = [], bool $disabled_option = false): string { $to_show = Dashboard::getAll(false, true, $params['context'] ?? 'core'); $can_view_all = $params['can_view_all'] ?? false; @@ -1500,6 +1505,10 @@ public static function dropdownDashboard(string $name = "", array $params = []): } } + if ($disabled_option) { + $options_dashboards = ['disabled' => __('Disabled')] + $options_dashboards; + } + return Dropdown::showFromArray($name, $options_dashboards, $params); } }