示例#1
0
 public function matchItem(ItemInterface $item)
 {
     if (null === $this->uri || null === $item->getUri()) {
         return null;
     }
     if ($item->getUri() === $this->uri) {
         return true;
     }
     return null;
 }
示例#2
0
 public function isAncestor(ItemInterface $item, $depth = null)
 {
     if (0 === $depth) {
         return false;
     }
     $childDepth = null === $depth ? null : $depth - 1;
     foreach ($item->getChildren() as $child) {
         if ($this->isCurrent($child) || $this->isAncestor($child, $childDepth)) {
             return true;
         }
     }
     return false;
 }
示例#3
0
 public function moveChildToPosition(ItemInterface $child, $position)
 {
     $name = $child->getName();
     $order = array_keys($this->children);
     $_position = array_search($name, $order);
     unset($order[$_position]);
     $order = array_values($order);
     array_splice($order, $position, 0, $name);
     $this->reorderChildren($order);
     return $this;
 }
示例#4
0
 protected function renderLabel(ItemInterface $item, array $options)
 {
     if ($options['allow_safe_labels'] && $item->getExtra('safe_label', false)) {
         return $item->getLabel();
     }
     return $this->escape($item->getLabel());
 }