/**
  * Create a MenuItem from a NodeInterface instance.
  *
  * @param NodeInterface $node
  *
  * @return MenuItem|null If allowEmptyItems is false and this node has
  *                       neither URL nor route nor a content that has a
  *                       route, returns null.
  */
 public function createFromNode(NodeInterface $node)
 {
     $event = new CreateMenuItemFromNodeEvent($node, $this);
     $this->dispatcher->dispatch(Events::CREATE_ITEM_FROM_NODE, $event);
     if ($event->isSkipNode()) {
         if ($node instanceof Menu) {
             // create an empty menu root to avoid the knp menu from failing.
             return $this->createItem('');
         }
         return;
     }
     $item = $event->getItem() ?: $this->createItem($node->getName(), $node->getOptions());
     if (empty($item)) {
         return;
     }
     if ($event->isSkipChildren()) {
         return $item;
     }
     return $this->addChildrenFromNode($node->getChildren(), $item);
 }
 /**
  * {@inheritDoc}
  */
 public function getOptions()
 {
     $connectedOption = $this->connectedNode->getOptions();
     return array('label' => $this->getLabel() ?: $connectedOption['label'], 'attributes' => array_merge($connectedOption['attributes'], $this->getAttributes()), 'childrenAttributes' => array_merge($connectedOption['childrenAttributes'], $this->getChildrenAttributes()), 'display' => $this->getDisplay() && $connectedOption['display'], 'displayChildren' => $this->getDisplayChildren() && $connectedOption['displayChildren'], 'linkAttributes' => array_merge($connectedOption['linkAttributes'], $this->getLinkAttributes()), 'labelAttributes' => array_merge($connectedOption['labelAttributes'], $this->getLabelAttributes()), 'uri' => $connectedOption['uri'], 'route' => $connectedOption['route'], 'linkType' => $connectedOption['linkType'], 'content' => $connectedOption['content']);
 }
 /**
  * {@inheritdoc}
  *
  * @see Knp\Menu.FactoryInterface::createFromNode()
  */
 public function createFromNode(NodeInterface $node)
 {
     $item = $this->createItem($node->getName(), $node->getOptions());
     /* @var $childNode NodeInterface */
     foreach ($node->getChildren() as $childNode) {
         $item->addChild($this->createFromNode($childNode));
     }
     return $item;
 }