mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
parent
ddafae6271
commit
1a6d1a20fb
@ -33,7 +33,7 @@ class LayoutController extends ActionController
|
|||||||
/** @var Hook\Layout\TopBar $hook */
|
/** @var Hook\Layout\TopBar $hook */
|
||||||
$hook = null;
|
$hook = null;
|
||||||
|
|
||||||
foreach (Hook::all(Hook::TARGET_LAYOUT_TOPBAR) as $hook) {
|
foreach (Hook::all('TopBar') as $hook) {
|
||||||
$topbarHtmlParts[] = $hook->getHtml($this->getRequest(), $this->view);
|
$topbarHtmlParts[] = $hook->getHtml($this->getRequest(), $this->view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,9 +573,14 @@ class Module
|
|||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
protected function registerHook($name, $key, $class)
|
protected function registerHook($name, $class, $key = null)
|
||||||
{
|
{
|
||||||
|
if ($key === null) {
|
||||||
|
$key = $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
Hook::register($name, $key, $class);
|
Hook::register($name, $key, $class);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,11 +45,6 @@ use \Icinga\Exception\ProgrammingError;
|
|||||||
*/
|
*/
|
||||||
class Hook
|
class Hook
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Hook name
|
|
||||||
*/
|
|
||||||
const TARGET_LAYOUT_TOPBAR = 'Layout\\TopBar';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Our hook name registry
|
* Our hook name registry
|
||||||
*
|
*
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Icinga\Web\Hook\Layout;
|
namespace Icinga\Web\Hook;
|
||||||
|
|
||||||
use \Icinga\Web\Request;
|
use \Icinga\Web\Request;
|
||||||
use \Zend_View;
|
use \Zend_View;
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Monitoring\Web\Hook;
|
namespace Icinga\Module\Monitoring\Web\Hook;
|
||||||
|
|
||||||
use Icinga\Web\Hook\Layout\TopBar as IcingaTopBar;
|
use Icinga\Web\Hook\TopBar as IcingaTopBar;
|
||||||
use Icinga\Module\Monitoring\DataView\StatusSummary as StatusSummaryView;
|
use Icinga\Module\Monitoring\DataView\StatusSummary as StatusSummaryView;
|
||||||
use Icinga\Web\Request;
|
use Icinga\Web\Request;
|
||||||
use Zend_View;
|
use Zend_View;
|
||||||
|
@ -6,18 +6,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Icinga\Application\Icinga;
|
$this->registerHook(
|
||||||
use Icinga\Authentication\Manager as AuthManager;
|
'TopBar',
|
||||||
use Icinga\Web\Hook;
|
|
||||||
|
|
||||||
if (Icinga::app()->isCli()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (AuthManager::getInstance()->isAuthenticated()) {
|
|
||||||
Hook::register(
|
|
||||||
Hook::TARGET_LAYOUT_TOPBAR,
|
|
||||||
'monitoring-topbar',
|
|
||||||
'Icinga\\Module\\Monitoring\\Web\\Hook\\TopBar'
|
'Icinga\\Module\\Monitoring\\Web\\Hook\\TopBar'
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user