diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:36:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:36:40 +0000 |
commit | a0901c4b7f2db488cb4fb3be2dd921a0308f4659 (patch) | |
tree | fafb393cf330a60df129ff10d0059eb7b14052a7 /library/Icingadb/Hook/TabHook.php | |
parent | Initial commit. (diff) | |
download | icingadb-web-a0901c4b7f2db488cb4fb3be2dd921a0308f4659.tar.xz icingadb-web-a0901c4b7f2db488cb4fb3be2dd921a0308f4659.zip |
Adding upstream version 1.0.2.upstream/1.0.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/Icingadb/Hook/TabHook.php')
-rw-r--r-- | library/Icingadb/Hook/TabHook.php | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/library/Icingadb/Hook/TabHook.php b/library/Icingadb/Hook/TabHook.php new file mode 100644 index 0000000..0c5b676 --- /dev/null +++ b/library/Icingadb/Hook/TabHook.php @@ -0,0 +1,82 @@ +<?php + +/* Icinga DB Web | (c) 2021 Icinga GmbH | GPLv2 */ + +namespace Icinga\Module\Icingadb\Hook; + +use Icinga\Module\Icingadb\Common\Auth; +use Icinga\Module\Icingadb\Common\Database; +use Icinga\Module\Icingadb\Hook\Common\HookUtils; +use ipl\Html\ValidHtml; +use ipl\Orm\Model; + +abstract class TabHook +{ + use Auth; + use Database; + use HookUtils; + + /** + * Get the tab's name + * + * The name is used to identify this hook later on. It must be unique. + * Multiple words in the name should be separated by dashes. (-) + * + * @return string + */ + abstract public function getName(): string; + + /** + * Get the tab's label + * + * The label is shown on the tab and in the browser's title. + * + * @return string + */ + abstract public function getLabel(): string; + + /** + * Get tab content for the given object + * + * @param Model $object + * + * @return ValidHtml[] + */ + abstract public function getContent(Model $object): array; + + /** + * Get tab controls for the given object + * + * @param Model $object + * + * @return ValidHtml[] + */ + public function getControls(Model $object): array + { + return []; + } + + /** + * Get tab footer for the given object + * + * @param Model $object + * + * @return ValidHtml[] + */ + public function getFooter(Model $object): array + { + return []; + } + + /** + * Get whether this tab should be shown + * + * @param Model $object + * + * @return bool + */ + public function shouldBeShown(Model $object): bool + { + return true; + } +} |