From e2beb7d0278e68dfb38ec000369b187949750783 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 2 Sep 2015 15:27:34 +0200 Subject: [PATCH] NavigationItem: Return the name if no label is set in getLabel() refs #5600 --- library/Icinga/Web/Navigation/NavigationItem.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/library/Icinga/Web/Navigation/NavigationItem.php b/library/Icinga/Web/Navigation/NavigationItem.php index 90a77a68f..d05229dcb 100644 --- a/library/Icinga/Web/Navigation/NavigationItem.php +++ b/library/Icinga/Web/Navigation/NavigationItem.php @@ -62,9 +62,9 @@ class NavigationItem implements Countable, IteratorAggregate protected $name; /** - * Label + * This item's label * - * @var string|null + * @var string */ protected $label; @@ -327,17 +327,17 @@ class NavigationItem implements Countable, IteratorAggregate } /** - * Get the label + * Return this item's label * - * @return string|null + * @return string */ public function getLabel() { - return $this->label; + return $this->label ?: $this->getName(); } /** - * Set the label + * Set this item's label * * @param string $label * @@ -345,7 +345,7 @@ class NavigationItem implements Countable, IteratorAggregate */ public function setLabel($label) { - $this->label = (string) $label; + $this->label = $label; return $this; }