NavigationItem: Improve merge "algorithm"
This commit is contained in:
parent
d54e5f62e6
commit
0cc06d6af9
|
@ -596,22 +596,32 @@ class NavigationItem implements IteratorAggregate
|
|||
throw new ProgrammingError('Cannot merge, conflict detected.');
|
||||
}
|
||||
|
||||
if ($this->priority === null && ($priority = $item->getPriority()) !== null) {
|
||||
$this->setPriority($priority);
|
||||
}
|
||||
|
||||
if ($item->getActive()) {
|
||||
$this->setActive();
|
||||
if ($this->priority === null) {
|
||||
$priority = $item->getPriority();
|
||||
if ($priority !== 100) {
|
||||
$this->setPriority($priority);
|
||||
}
|
||||
}
|
||||
|
||||
if (! $this->getIcon()) {
|
||||
$this->setIcon($item->getIcon());
|
||||
}
|
||||
|
||||
if ($this->getLabel() === $this->getName()) {
|
||||
if ($this->getLabel() === $this->getName() && $item->getLabel() !== $item->getName()) {
|
||||
$this->setLabel($item->getLabel());
|
||||
}
|
||||
|
||||
if ($this->target === null && ($target = $item->getTarget()) !== null) {
|
||||
$this->setTarget($target);
|
||||
}
|
||||
|
||||
if ($this->renderer === null) {
|
||||
$renderer = $item->getRenderer();
|
||||
if (get_class($renderer) !== 'NavigationItemRenderer') {
|
||||
$this->setRenderer($renderer);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($item->getAttributes() as $name => $value) {
|
||||
$this->setAttribute($name, $value);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue