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 --- library/Icingadb/Common/TicketLinks.php | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 library/Icingadb/Common/TicketLinks.php (limited to 'library/Icingadb/Common/TicketLinks.php') diff --git a/library/Icingadb/Common/TicketLinks.php b/library/Icingadb/Common/TicketLinks.php new file mode 100644 index 0000000..6cf7e76 --- /dev/null +++ b/library/Icingadb/Common/TicketLinks.php @@ -0,0 +1,56 @@ +ticketLinkEnabled = $state; + + return $this; + } + + /** + * Get whether list items should render host and service links + * + * @return bool + */ + public function getTicketLinkEnabled(): bool + { + return $this->ticketLinkEnabled; + } + + /** + * Get whether list items should render host and service links + * + * @return string + */ + public function createTicketLinks($text): string + { + if (Hook::has('ticket')) { + $tickets = Hook::first('ticket'); + } + + if ($this->getTicketLinkEnabled() && isset($tickets)) { + /** @var \Icinga\Application\Hook\TicketHook $tickets */ + return $tickets->createLinks($text); + } + + return $text; + } +} -- cgit v1.2.3