Add menu filter.

@param MenuFilterInterface $menuFilter Menu filter
@param array               $menus      Menus
@param string              $stage      Stage
@param int                 $priority   Priority

@return $this Self object
439039
public function addMenuFilter(
        MenuFilterInterface $menuFilter,
        array $menus,
        $stage,
        $priority
    ) {
        $this->addElement(
            $menuFilter,
            $menus,
            $stage,
            $priority
        );

        return $this;
    }
638692
public function addMenuEntry($location, MenuEntry $menuEntry, $priority = 50)
    {
        if (!isset($this->menuEntries[$location])) {
            $this->menuEntries[$location] = array();
        }
        
        if (!isset($this->menuEntries[$location][$priority])) {
            $this->menuEntries[$location][$priority] = array();
        }

        if (isset($this->menuEntries[$location][$priority][$menuEntry->getKey()])) {
            return false;
        }
        
        $this->menuEntries[$location][$priority][$menuEntry->getKey()] = $menuEntry;
        
        ksort($this->menuEntries[$location]);
        uasort($this->menuEntries[$location][$priority], array($this, 'sortMenuEntries'));
        
        return true;
    }
700489
public function addVisitor(VisitorInterface $visitor, $priority = 0)
    {
        $this->sortedVisitors = null;

        $this->visitors[spl_object_hash($visitor)] = array(
            'priority' => $priority,
            'visitor' => $visitor
        );

        return $this;
    }
662694
public function addToolbar($toolbar, $config = array(), $priority = AnEvent::PRIORITY_NORMAL)
    {
        if (! ($toolbar instanceof AnControllerToolbarInterface)) {
            $toolbar = $this->_mixer->getToolbar($toolbar, $config);
        }

        //Add the toolbars
        $this->_toolbars[$toolbar->getIdentifier()->name] = $toolbar;

        //Add the toolbar
        if ($this->inherits('AnMixinEvent')) {
            $this->addEventSubscriber($toolbar, $priority);
        }

        return $this->getMixer();
    }
143411
private function addRule(RuleInterface $rule, int $priority): void
    {
        $this->queueOfRules->push($rule, $priority);
    }
68065
public function addSection(NavigationSectionInterface $section, $priority = 1)
    {
        intval($priority);
        while (isset($this->sections[$priority])) {
            $priority++;
        }

        $this->sections[$priority] = $section;
        $section->setRootSection($this);

        return $section;
    }
226953
public function addProductionMenuItems(MenuCollectionEvent $event): void
    {
        // We only operate on group member users.
        $user = $this->token_storage->getToken()->getUser();
        if (!$user instanceof GroupMemberInterface) {
            return;
        }

        // Create productions menu dropdown item.
        $productions = $this->factory->createItem('menu_item.productions', [
            'extras' => ['translation_domain' => BkstgCoreBundle::TRANSLATION_DOMAIN],
        ]);

        $items = [];
        foreach ($user->getMemberships() as $membership) {
            // Get the group for this membership, if not a production skip out.
            $group = $membership->getGroup();

            // If the membership and production are active and not expired.
            if ($membership->isActive()
                && !$membership->isExpired()
                && $group->isActive()
                && !$group->isExpired()) {
                // The membership is good, add a menu item.
                $items[] = $this->factory->createItem($membership->getGroup()->getName(), [
                    'route' => 'bkstg_production_read',
                    'routeParameters' => ['production_slug' => $membership->getGroup()->getSlug()],
                    'extras' => ['translation_domain' => false],
                ]);
            }
        }

        if (0 === count($user->getMemberships())) {
            $productions->addChild($this->factory->createItem('menu_item.no_productions', [
                'uri' => '#',
                'extras' => [
                    'translation_domain' => BkstgCoreBundle::TRANSLATION_DOMAIN,
                ],
            ]));
        } else {
            // Add all children (in alpha order) to production item.
            usort($items, function ($a, $b) {
                return strcasecmp($a->getLabel(), $b->getLabel());
            });
            $productions->setChildren($items);
        }

        // Add the production menu item to the main menu.
        $menu = $event->getMenu();
        $menu->addChild($productions);
    }
131221
public function applyChange(
        MenuInterface $menu,
        $stage
    ) {
        $menu->setSubnodes(
            $this->applyFiltersToMenuNodes(
                $menu->getSubnodes(),
                $menu->getCode(),
                $stage
            )
        );

        return $this;
    }
1306818
public function addFilter(Filter $filter, $key = null) {
        $filter->setParser($this);

        if (!$key) {
            $key = explode('\\', get_class($filter));
            $key = str_replace('Filter', '', end($key));
        }

        $tags = $filter->getTags();

        $this->_filters[$key] = $filter;
        $this->_tags = $tags + $this->_tags;

        foreach ($tags as $tag => $options) {
            $this->_filterMap[$tag] = $key;
        }

        $filter->setupHooks($this);

        return $this;
    }
725664
private function applyModifiersToMenuNodes(
        Collection $menuNodes,
        $menuCode,
        $stage
    ) {
        $menuNodes->map(function (NodeInterface $menuNode) use ($menuCode, $stage) {

            $this->applyModifiersToMenuNodes(
                $menuNode->getSubnodes(),
                $menuCode,
                $stage
            );

            $menuModifiers = $this->getElementsByMenuCodeAndStage(
                $menuCode,
                $stage
            );

            /**
             * @var MenuModifierInterface $menuModifier
             */
            foreach ($menuModifiers as $menuModifier) {
                $menuModifier->modify($menuNode);
            }
        });

        return $this;
    }
806812
public function addFilter(string $filterName, callable  $callback, int $priority = 20, $args = 1)
	{
		$this->filters[$filterName][$priority][] = [$callback,$args];
	}
681870
private function filterParents($menuLinks)
    {
        $tmp = [];
        foreach($menuLinks as $key => $menuLink){
            if(isset($menuLink['parent']) && !$menuLink['parent']) {
                $tmp[$key] = $menuLink;
            }
        }
        return $tmp;
    }
75609
public function addSubMenu( $attributes = [], $priority = 10 )
    {
        $defaultAttributes = [
            'page_title' => $this->plugin['config']->get('plugin.namespace'),
            'menu_title' => $this->plugin['config']->get('plugin.namespace'),
            'capability' => 'read',
            'menu_slug' => $this->plugin['config']->get('plugin.slug'),
            'parent_slug' => '',
            'controller' => '',
        ];

        $attributes = array_merge($defaultAttributes,$attributes);

        add_action('admin_menu', function () use ($attributes) {
            // Add shortcode support for widgets
            add_submenu_page(
                $attributes['parent_slug'],
                $attributes['page_title'],
                $attributes['menu_title'],
                $attributes['capability'],
                $attributes['menu_slug'],
                function () use ( $attributes ){
                    return $this->executeController($attributes['controller'], $attributes);
                }
            );
        }, $priority);
    }
372793
public function addElement(
        $element,
        $menus,
        $stage,
        $priority = 0
    ) {
        $priority = (int) $priority;
        $elementId = spl_object_hash($element);
        $menus = is_array($menus)
            ? $menus
            : [$menus];

        if (empty($menus)) {
            $this->allElements[$elementId] = $element;
        } else {
            foreach ($menus as $menu) {
                $this->addElementByMenuCode(
                    $element,
                    $menu
                );
            }
        }

        $this->addElementByStage(
            $element,
            $stage
        );

        $this->priorities[$elementId] = $priority;

        return $this;
    }
910711
protected function addButtons(\Gems_Menu_MenuList $menuList)
    {
        $menuList->addByController('respondent', 'show', $this->_('Show respondent'))
                ->addByController('track', 'index', $this->_('Show tracks'))
                ->addByController('track', 'show-track', $this->_('Show track'))
                ->addByController('track', 'show', $this->_('Show token'))
                ->addCurrentSiblings()
                ->addCurrentChildren();
    }
969167
final protected function addFilterResBV($f, $priority = FilterChain::DEFAULT_PRIORITY) {
		$this->_filtersResBV->attach($f, $priority);
	}
411599
public function addFilter(FilterInterface $filter) {
        if ($filter->supportsType($this->getType())) {
            $this->filters[] = $filter;
        }
        return $this;
    }