NavigationItem: Accept priority while merging if none is set yet
This commit is contained in:
parent
57f30b1f92
commit
d54e5f62e6
|
@ -131,7 +131,6 @@ class NavigationItem implements IteratorAggregate
|
||||||
public function __construct($name, array $properties = null)
|
public function __construct($name, array $properties = null)
|
||||||
{
|
{
|
||||||
$this->setName($name);
|
$this->setName($name);
|
||||||
$this->priority = 100;
|
|
||||||
$this->children = new Navigation();
|
$this->children = new Navigation();
|
||||||
|
|
||||||
if (! empty($properties)) {
|
if (! empty($properties)) {
|
||||||
|
@ -207,7 +206,7 @@ class NavigationItem implements IteratorAggregate
|
||||||
*/
|
*/
|
||||||
public function getPriority()
|
public function getPriority()
|
||||||
{
|
{
|
||||||
return $this->priority;
|
return $this->priority !== null ? $this->priority : 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -597,6 +596,10 @@ class NavigationItem implements IteratorAggregate
|
||||||
throw new ProgrammingError('Cannot merge, conflict detected.');
|
throw new ProgrammingError('Cannot merge, conflict detected.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->priority === null && ($priority = $item->getPriority()) !== null) {
|
||||||
|
$this->setPriority($priority);
|
||||||
|
}
|
||||||
|
|
||||||
if ($item->getActive()) {
|
if ($item->getActive()) {
|
||||||
$this->setActive();
|
$this->setActive();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue