From 408bb9c886da042775b2a040aa9329c298eb5f29 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Thu, 2 Jun 2022 19:08:08 +0200 Subject: [PATCH] Introduce trait `WidgetState` --- .../Web/Dashboard/Common/WidgetState.php | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 library/Icinga/Web/Dashboard/Common/WidgetState.php diff --git a/library/Icinga/Web/Dashboard/Common/WidgetState.php b/library/Icinga/Web/Dashboard/Common/WidgetState.php new file mode 100644 index 000000000..40e2c6251 --- /dev/null +++ b/library/Icinga/Web/Dashboard/Common/WidgetState.php @@ -0,0 +1,73 @@ +disabled = $disabled; + + return $this; + } + + /** + * Get whether this widget has been disabled + * + * @return bool + */ + public function isDisabled(): bool + { + return $this->disabled; + } + + /** + * Set whether this widget is currently being loaded + * + * @param bool $active + * + * @return $this + */ + public function setActive(bool $active = true): self + { + $this->active = $active; + + return $this; + } + + /** + * Get whether this widget is currently being loaded + * + * This indicates which dashboard tab is currently open if this widget type is a Dashboard Pane + * or whether the Dashboard Home in the navigation bar is active/focused + * + * @return bool + */ + public function isActive(): bool + { + return $this->active; + } +}