public function testGetCurrentMenuItem()
 {
     $item = new MenuItem('testItem', $this->factory);
     $goodItem = new MenuItem('goodItem', $this->factory);
     $subItem = new MenuItem('subItem', $this->factory);
     $goodItem->addChild($subItem);
     $params = array('testItem' => false, 'goodItem' => false, 'subItem' => true);
     $this->matcher->expects($this->any())->method('isCurrent')->with($this->logicalOr($this->equalTo($item), $this->equalTo($goodItem), $this->equalTo($subItem)))->will($this->returnCallback(function ($param) use(&$params) {
         return $params[$param->getLabel()];
     }));
     $this->assertEquals($subItem, $this->manager->getCurrentMenuItem(array($item, $goodItem)));
 }
 /**
  * Render breadcrumbs for menu
  *
  * @param \Twig_Environment $environment
  * @param string $menuName
  * @param bool $useDecorators
  * @return null|string
  */
 public function renderBreadCrumbs(\Twig_Environment $environment, $menuName, $useDecorators = true)
 {
     if ($breadcrumbs = $this->breadcrumbManager->getBreadcrumbs($menuName, $useDecorators)) {
         $template = $environment->loadTemplate(self::BREADCRUMBS_TEMPLATE);
         return $template->render(array('breadcrumbs' => $breadcrumbs, 'useDecorators' => $useDecorators));
     }
     return null;
 }
 /** {@inheritdoc} */
 public function getBreadcrumbLabels($menu, $routeName)
 {
     $route = $this->router->getRouteCollection()->get($routeName);
     if ($this->isRouteFrontend($route)) {
         $menu = self::FRONTEND_MENU;
     }
     return parent::getBreadcrumbLabels($menu, $routeName);
 }
示例#4
0
 /**
  * @param $route
  * @return array
  */
 protected function getBreadcrumbs($route)
 {
     return $this->breadcrumbManager->getBreadcrumbLabels($this->userConfigManager->get('oro_navigation.breadcrumb_menu'), $route);
 }