diff --git a/library/Director/ProvidedHook/CubeLinks.php b/library/Director/ProvidedHook/CubeLinks.php index 4cbdd9f6..015fba8c 100644 --- a/library/Director/ProvidedHook/CubeLinks.php +++ b/library/Director/ProvidedHook/CubeLinks.php @@ -10,11 +10,12 @@ use Icinga\Web\View; class CubeLinks extends ActionLinksHook { - public function getHtml(View $view, Cube $cube) + public function prepareActionLinks(Cube $cube, View $view) { if (! $cube instanceof IdoHostStatusCube) { - return ''; + return; } + $cube->finalizeInnerQuery(); $query = $cube->innerQuery() ->reset('columns') @@ -23,9 +24,16 @@ class CubeLinks extends ActionLinksHook $hosts = $cube->db()->fetchCol($query); - if (count($hosts) === 1) { + $count = count($hosts); + if ($count === 1) { $url = 'director/host/edit'; $params = array('name' => $hosts[0]); + + $title = $view->translate('Modify a host'); + $description = sprintf( + $view->translate('This allows you to modify properties for "%s"'), + $hosts[0] + ); } else { $params = null; @@ -37,13 +45,18 @@ class CubeLinks extends ActionLinksHook } $url = 'director/hosts/edit?' . $filter->toQueryString(); + + $title = sprintf($view->translate('Modify %d hosts'), $count); + $description = $view->translate( + 'This allows you to modify properties for all chosen hosts at once' + ); } - return $view->qlink( - $view->translate('Modify hosts'), - $url, - $params, - array('class' => 'icon-wrench') + $this->addActionLink( + $this->makeUrl($url, $params), + $title, + $description, + 'wrench' ); } }