Ojs\JournalBundle\Menu\MenuBuilder::topLeftMenu PHP Méthode

topLeftMenu() public méthode

public topLeftMenu ( Knp\Menu\FactoryInterface $factory )
$factory Knp\Menu\FactoryInterface
    public function topLeftMenu(FactoryInterface $factory)
    {
        /**
         * @var Journal $journal
         * @var AuthorizationChecker $checker
         */
        $dispatcher = $this->container->get('event_dispatcher');
        $checker = $this->container->get('security.authorization_checker');
        $journal = $this->container->get('ojs.journal_service')->getSelectedJournal();
        $journalId = $journal->getId();
        $menu = $factory->createItem('root')->setChildrenAttribute('class', 'nav nav-sidebar');
        $menu->addChild('dashboard', ['route' => 'ojs_journal_dashboard_index', 'routeParameters' => ['journalId' => $journalId], 'extras' => ['icon' => 'dashboard']]);
        if ($checker->isGranted('CREATE', $journal, 'articles')) {
            $menu->addChild('article.submit', ['route' => 'ojs_journal_submission_new', 'routeParameters' => ['journalId' => $journalId], 'extras' => ['icon' => 'plus-circle']]);
        }
        $menuEvent = new MenuEvent();
        $menuEvent->setMenuItem($menu);
        $dispatcher->dispatch(MenuEvents::TOP_LEFT_MENU_INITIALIZED, $menuEvent);
        return $menuEvent->getMenuItem();
    }