From b18bc644404e02b57635bfcc8258e85abb141146 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 13:44:46 +0200 Subject: Adding upstream version 1.1.1. Signed-off-by: Daniel Baumann --- .../Icingadb/Web/Control/GridViewModeSwitcher.php | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 library/Icingadb/Web/Control/GridViewModeSwitcher.php (limited to 'library/Icingadb/Web/Control/GridViewModeSwitcher.php') diff --git a/library/Icingadb/Web/Control/GridViewModeSwitcher.php b/library/Icingadb/Web/Control/GridViewModeSwitcher.php new file mode 100644 index 0000000..df5524b --- /dev/null +++ b/library/Icingadb/Web/Control/GridViewModeSwitcher.php @@ -0,0 +1,38 @@ + 'default', + 'grid' => 'grid' + ]; + + protected function getTitle(string $viewMode): string + { + $active = null; + $inactive = null; + switch ($viewMode) { + case 'list': + $active = t('List view active'); + $inactive = t('Switch to list view'); + break; + case 'grid': + $active = t('Grid view active'); + $inactive = t('Switch to grid view'); + break; + } + + return $viewMode === $this->getViewMode() ? $active : $inactive; + } +} -- cgit v1.2.3