mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
parent
0a9aa20dfa
commit
fb2abf40f8
@ -4,6 +4,7 @@
|
|||||||
namespace Icinga\Module\Monitoring\Hook;
|
namespace Icinga\Module\Monitoring\Hook;
|
||||||
|
|
||||||
use Icinga\Module\Monitoring\Object\MonitoredObject;
|
use Icinga\Module\Monitoring\Object\MonitoredObject;
|
||||||
|
use Icinga\Web\View;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for hooks extending the detail view of monitored objects
|
* Base class for hooks extending the detail view of monitored objects
|
||||||
@ -12,6 +13,13 @@ use Icinga\Module\Monitoring\Object\MonitoredObject;
|
|||||||
*/
|
*/
|
||||||
abstract class DetailviewExtensionHook
|
abstract class DetailviewExtensionHook
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* The view the generated HTML will be included in
|
||||||
|
*
|
||||||
|
* @var View
|
||||||
|
*/
|
||||||
|
private $view;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new hook
|
* Create a new hook
|
||||||
*
|
*
|
||||||
@ -37,4 +45,27 @@ abstract class DetailviewExtensionHook
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
abstract public function getHtmlForObject(MonitoredObject $object);
|
abstract public function getHtmlForObject(MonitoredObject $object);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get {@link view}
|
||||||
|
*
|
||||||
|
* @return View
|
||||||
|
*/
|
||||||
|
public function getView()
|
||||||
|
{
|
||||||
|
return $this->view;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set {@link view}
|
||||||
|
*
|
||||||
|
* @param View $view
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setView($view)
|
||||||
|
{
|
||||||
|
$this->view = $view;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ abstract class MonitoredObjectController extends Controller
|
|||||||
$this->view->extensionsHtml = array();
|
$this->view->extensionsHtml = array();
|
||||||
foreach (Hook::all('Monitoring\DetailviewExtension') as $hook) {
|
foreach (Hook::all('Monitoring\DetailviewExtension') as $hook) {
|
||||||
/** @var DetailviewExtensionHook $hook */
|
/** @var DetailviewExtensionHook $hook */
|
||||||
$this->view->extensionsHtml[] = $hook->getHtmlForObject($this->object);
|
$this->view->extensionsHtml[] = $hook->setView($this->view)->getHtmlForObject($this->object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user