mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 22:04:25 +02:00
parent
95a3f1c011
commit
c03109c4c6
@ -4,9 +4,11 @@
|
|||||||
namespace Icinga\Web\Navigation;
|
namespace Icinga\Web\Navigation;
|
||||||
|
|
||||||
use Countable;
|
use Countable;
|
||||||
|
use Exception;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use IteratorAggregate;
|
use IteratorAggregate;
|
||||||
use Icinga\Application\Icinga;
|
use Icinga\Application\Icinga;
|
||||||
|
use Icinga\Exception\IcingaException;
|
||||||
use Icinga\Web\View;
|
use Icinga\Web\View;
|
||||||
use Icinga\Web\Url;
|
use Icinga\Web\Url;
|
||||||
|
|
||||||
@ -451,18 +453,20 @@ class NavigationItem implements Countable, IteratorAggregate
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the navigation item to HTML
|
* Return this item rendered to HTML
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
$view = $this->getView();
|
$view = $this->getView();
|
||||||
|
|
||||||
$label = $view->escape($this->getLabel());
|
$label = $view->escape($this->getLabel());
|
||||||
if (null !== $icon = $this->getIcon()) {
|
if (($icon = $this->getIcon()) !== null) {
|
||||||
$label = $view->icon($icon) . $label;
|
$label = $view->icon($icon) . $label;
|
||||||
}
|
}
|
||||||
if (null !== $url = $this->getUrl()) {
|
|
||||||
|
if (($url = $this->getUrl()) !== null) {
|
||||||
$content = sprintf(
|
$content = sprintf(
|
||||||
'<a%s href="%s">%s</a>',
|
'<a%s href="%s">%s</a>',
|
||||||
$view->propertiesToString($this->getAttributes()),
|
$view->propertiesToString($this->getAttributes()),
|
||||||
@ -477,16 +481,21 @@ class NavigationItem implements Countable, IteratorAggregate
|
|||||||
$label
|
$label
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the navigation item to HTML
|
* Return this item rendered to HTML
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
return $this->render();
|
try {
|
||||||
|
return $this->render();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return IcingaException::describe($e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user