Add the dashboard menu item.

@param MenuCollectionEvent $event The menu collection event.

@return void
195632
public function addDashboardMenuItem(MenuCollectionEvent $event): void
    {
        $menu = $event->getMenu();

        // Create overview menu item.
        $dashboard = $this->factory->createItem('menu_item.dashboard', [
            'route' => 'bkstg_admin_dashboard',
            'extras' => [
                'icon' => 'tachometer-alt',
                'translation_domain' => BkstgCoreBundle::TRANSLATION_DOMAIN,
            ],
        ]);
        $menu->addChild($dashboard);
    }
827694
public void addMenuItem(Runnable item) {
        items.add(item);
        if (item instanceof Menu) {
        	((Menu) item).parent = this;
        }
    }
540711
public function addLogoutItem(MenuCollectionEvent $event): void
    {
        $menu = $event->getMenu();

        $separator = $this->factory->createItem('separator', [
            'extras' => [
                'separator' => true,
                'translation_domain' => false,
            ],
        ]);
        $menu->addChild($separator);

        // Create logout menu item.
        $logout = $this->factory->createItem('menu_item.logout', [
            'route' => 'fos_user_security_logout',
            'extras' => [
                'icon' => 'sign-out',
                'translation_domain' => BkstgCoreBundle::TRANSLATION_DOMAIN,
            ],
        ]);
        $menu->addChild($logout);
    }
1021037
public function postLoad(LifecycleEventArgs $event)
    {
        $entity = $event->getEntity();

        if (! ($entity instanceof Menu)) {
            return;
        }

        $builder = $this->builderRegistry->getBuilder($entity->getType());
        $entity->setBuilder($builder);
    }
1230746
public function addItem($name, \SlimStarter\Menu\MenuItem $item){
        $this->items[$name] = $item;
    }
72054
public function buildMenus(MenuEvent $event)
    {
        if (!$this->applicationConfiguration->getParameter('enable_menus')) {
            return;
        }
        $menuConfigurations = array_merge_recursive(
            $this->adminMenuConfigurations,
            $event->getMenuConfigurations()
        );
        $configurationEvent = new MenuConfigurationEvent($menuConfigurations);

        // Dispatch a pre-menu build event to allow dynamic configuration modifications
        $this
            ->eventDispatcher
            ->dispatch(Events::MENU_CONFIGURATION, $configurationEvent)
        ;
        $menuConfigurations = $configurationEvent->getMenuConfigurations();

        foreach ($menuConfigurations as $name => $menuConfiguration) {
            $this->menuFactory->create($name, $menuConfiguration);
        }
    }
676291
protected function setBreadcrumbListCollectionItem()
    {
        $breadcrumbs = array();

        $breadcrumbs[] = array(
            'url' => $this->url('admin'),
            'text' => $this->text('Dashboard')
        );

        $breadcrumbs[] = array(
            'text' => $this->text('Collections'),
            'url' => $this->url('admin/content/collection')
        );

        $this->setBreadcrumbs($breadcrumbs);
    }
164137
public function addEvent($collection, array $event = array())
    {
        $event['event_collection'] = $collection;
        $event['projectId'] = $this->getConfig('projectId');
        $event['writeKey'] = $this->getKeyForWriting();

        $command = parent::getCommand('addEvent', $event);

        return $this->execute($command);
    }
488558
public function addResourceItem(ProductionMenuCollectionEvent $event): void
    {
        $menu = $event->getMenu();
        $group = $event->getGroup();

        // Create resource menu item.
        $resources = $this->factory->createItem('menu_item.resources', [
            'route' => 'bkstg_resource_index',
            'routeParameters' => ['production_slug' => $group->getSlug()],
            'extras' => [
                'icon' => 'file',
                'translation_domain' => BkstgResourceBundle::TRANSLATION_DOMAIN,
            ],
        ]);
        $menu->addChild($resources);

        // If this user is an editor create the post and archive items.
        if ($this->auth->isGranted('GROUP_ROLE_EDITOR', $group)) {
            $resources_resources = $this->factory->createItem('menu_item.resources_resources', [
                'route' => 'bkstg_resource_index',
                'routeParameters' => ['production_slug' => $group->getSlug()],
                'extras' => ['translation_domain' => BkstgResourceBundle::TRANSLATION_DOMAIN],
            ]);
            $resources->addChild($resources_resources);

            $archive = $this->factory->createItem('menu_item.resources_archive', [
                'route' => 'bkstg_resource_archive',
                'routeParameters' => ['production_slug' => $group->getSlug()],
                'extras' => ['translation_domain' => BkstgResourceBundle::TRANSLATION_DOMAIN],
            ]);
            $resources->addChild($archive);
        }
    }
754306
public function addPlatformItem($menuName, $url, $order = 50, $tooltip = false)
    {
        $this->addItem('CorePluginsAdmin_MenuPlatform', $menuName, $url, $order, $tooltip);
    }
1302268
public function add($item)
    {
        if ($item instanceof ItemInterface) {
            $this->items[] = $item;
        } else {
            $this->items[] = new MulticardsItem($item);
        }
    }
1174093
public void addOrUpdateItem(int parentId, MenuItem item) {
        synchronized (subMenuItems) {
            getSubMenuById(parentId).ifPresent(subMenu-> {
                if(getMenuItems(subMenu).stream().anyMatch(it-> it.getId() == item.getId())) {
                    replaceMenuById(asSubMenu(subMenu), item);
                }
                else {
                    addMenuItem(asSubMenu(subMenu), item);
                }
            });
        }
    }
516267
public function addProductionFilter(FilterCollectionEvent $event): void
    {
        $now = new \DateTime();
        $qb = $event->getQueryBuilder();
        $query = $qb->query()->bool()
            ->addMust($qb->query()->term(['_index' => 'production']))
            ->addMust($qb->query()->term(['active' => true]))
            ->addMust($qb->query()->terms('id', $event->getGroupIds()))
            ->addMust(
                $qb->query()->bool()
                    ->addShould($qb->query()->range('expiry', ['gt' => $now->format('U') * 1000]))
                    ->addShould($qb->query()->bool()->addMustNot($qb->query()->exists('expiry')))
            )
        ;
        $event->addFilter($query);
    }
142679
public function onMenuDisplay(AnEvent $event)
    {
        $actor = $event->actor;
        $menuItems = $event->menuItems;

        if ($this->activeForActor($actor)) {
            $this->_setMenuLinks($actor, $menuItems);
        }
    }
741604
public function addMenuItem($options)
    {
        foreach (['alias', 'name', 'priority'] as $attr) {
            if (!isset($options[$attr]) || (isset($options[$attr]) && $options[$attr] === '')) {
                throw new Exception('$options[\'' . $attr . '\'] is missing.');
            }
        }

        $menuItem = [
            'alias' => $options['alias'],
            'name' => $options['name'],
            'priority' => $options['priority'],
            'matchAction' => $options['matchAction'] ?? false,
            'doNotMatchAction' => [],
            'linkOptions' => $options['linkOptions'] ?? []
        ];

        if (isset($options['name_short'])) {
            $menuItem['name_short'] = $options['name_short'];
        }

        if (isset($options['icon'])) {
            $menuItem['icon'] = $options['icon'];
        }

        if (isset($options['url']) && is_array($options['url']) && !empty($options['url'])) {
            $url = $options['url'];
            if (!isset($url['plugin']) || (isset($url['plugin']) && $url['plugin'] === '')) {
                $url['plugin'] = null;
            }
            if (!isset($url['controller'])) {
                throw new Exception('$options[\'url\'][\'controller\'] is missing.');
            }
            if (!isset($url['action'])) {
                throw new Exception('$options[\'url\'][\'action\'] is missing.');
            }
            $menuItem['url'] = $url;
        }

        if (isset($options['doNotMatchAction'])) {
            $menuItem['doNotMatchAction'] = is_array($options['doNotMatchAction']) ? $options['doNotMatchAction'] : [$options['doNotMatchAction']];
        }

        if (isset($options['parent'])) {
            if (!isset($this->_menuItems[$options['parent']])) {
                throw new Exception('No menu item with the alias specified in $options[\'parent\'] "' . $options['parent'] . '"exists.');
            }
            $menuItem['parent'] = $options['parent'];
            $this->_menuItems[$menuItem['parent']]['children'][$menuItem['alias']] = $menuItem;
        } else {
            $this->_menuItems[$menuItem['alias']] = $menuItem;
        }

        return $this;
    }
505107
public function addGlobal(Event $event)
    {
        $topNavbar = $this->menuBuilder->getTopNavbar();

        $topNavbar
            ->addChild('menu.sitemap', [
                'route' => 'victoire_sitemap_reorganize',
            ])
            ->setLinkAttribute('data-toggle', 'vic-modal');
    }
525080
public function onContextPaneInit(ContextPaneEvent $event)
    {
        $site = null;
        $contextPane = $event->getContextPane();

        if ($this->siteManager->hasContext()) {
            $site = $this->siteManager->getContext();
        }

        // Add admin actions on the tree listing page
        if ('admin/dashboard/tree' === current_path()) {
            $canCreate = false;
            if ($site) {
                $canCreate = $this->menuAccess->canCreateMenu($this->currentUser, $site);
            } else {
                $canCreate = $this->menuAccess->canCreateMenu($this->currentUser);
            }
            if ($canCreate) {
                $contextPane->addActions([
                    new Action($this->t("Create menu"), 'admin/dashboard/tree/add', [], 'plus', 0, true, true),
                ]);
            }
        }

        if ($site) {
            // Add the tree structure as a new tab
            $contextPane
                ->addTab('tree', $this->t("Menu tree"), 'bars')
                ->add($this->renderCurrentTree(), 'tree')
            ;

            if (preg_match('@^admin/dashboard/tree/(\d+)$@', current_path())) {
                // Default tab on tree edit is the cart
                $contextPane->setDefaultTab('cart');
            } elseif (!$contextPane->getRealDefaultTab()) {
                // Else it's the tree
                $contextPane->setDefaultTab('tree');
            }
        }
    }