public function addNodeToMenu(Menu $menu, MenuItem $node, $startDepth)
{
if ($node->getLvl() < $startDepth) {
return false;
}
if ($node->getLvl() > $startDepth) {
$menu = $this->getParentMenu($menu, $node);
}
if (is_object($menu)) {
$knpMenuNode = $this->createFromMenuItem($node);
if (!is_null($knpMenuNode)) {
$menu->addChild($knpMenuNode);
$knpMenuNode->setAttribute('class', $node->getLinkClass());
if ($node->getVisibility() != MenuItem::VISIBILITY_PUBLIC && !$this->isLoggedIn) {
$knpMenuNode->setDisplay(false);
}
return $knpMenuNode;
}
}
return false;
}