mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-31 01:34:09 +02:00
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
|
<?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
|
// 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'));
|
$newTabInfo = sprintf('<span class="info-box display-on-hover"> %s </span>', $this->translate('opens in new window'));
|
||||||
|
|
||||||
$links = $object->getActionUrls();
|
foreach ($object->getActionUrls() as $i => $link) {
|
||||||
foreach ($links as $i => $link) {
|
$navigation->addItem(
|
||||||
$links[$i] = sprintf('<a href="%s" target="_blank">%s ' . $newTabInfo . '</a>', $link, 'Action');
|
'Action ' . ($i + 1) . $newTabInfo,
|
||||||
|
array(
|
||||||
|
'url' => $link,
|
||||||
|
'target' => '_blank'
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->actions)) {
|
if (isset($this->actions)) {
|
||||||
foreach ($this->actions as $id => $action) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= $this->translate('Actions') ?></th>
|
<th><?= $this->translate('Actions'); ?></th>
|
||||||
<td><?= implode("<br>", $links) ?></td>
|
<?= $navigation->getRenderer()->setElementTag('td'); ?>
|
||||||
</tr>
|
</tr>
|
Loading…
x
Reference in New Issue
Block a user