actions.phtml: Use the new Navigation to load and render action urls
refs #5600
This commit is contained in:
parent
f9b68b683b
commit
4983d46dd7
|
@ -1,25 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Icinga\Web\Navigation\Navigation;
|
||||
|
||||
$navigation = new Navigation();
|
||||
|
||||
// add warning to links that open in new tabs to improve accessibility, as recommended by WCAG20 G201
|
||||
$newTabInfo = sprintf('<span class="info-box display-on-hover"> %s </span>', $this->translate('opens in new window'));
|
||||
|
||||
$links = $object->getActionUrls();
|
||||
foreach ($links as $i => $link) {
|
||||
$links[$i] = sprintf('<a href="%s" target="_blank">%s ' . $newTabInfo . '</a>', $link, 'Action');
|
||||
foreach ($object->getActionUrls() as $i => $link) {
|
||||
$navigation->addItem(
|
||||
'Action ' . ($i + 1) . $newTabInfo,
|
||||
array(
|
||||
'url' => $link,
|
||||
'target' => '_blank'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($this->actions)) {
|
||||
foreach ($this->actions as $id => $action) {
|
||||
$links[] = sprintf('<a href="%s">%s</a>', $action, $id);
|
||||
$navigation->addItem($id, array('url' => $action));
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($links)) {
|
||||
if ($navigation->isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th><?= $this->translate('Actions') ?></th>
|
||||
<td><?= implode("<br>", $links) ?></td>
|
||||
</tr>
|
||||
<th><?= $this->translate('Actions'); ?></th>
|
||||
<?= $navigation->getRenderer()->setElementTag('td'); ?>
|
||||
</tr>
|
Loading…
Reference in New Issue