Returns current menu items.

@param bool $position

@return ItemInterface[]
186998
public function getPageHeaderMenuItems($position = false)
    {
        if ($position) {
            $tmpItems = array();
            foreach ($this->pageHeaderMenuItems as $mi) {
                if ($mi->getPosition() == $position) {
                    $tmpItems[] = $mi;
                }
            }

            return $tmpItems;
        } else {
            return $this->pageHeaderMenuItems;
        }
    }
361273
public function getNextEol($position = self::CURRENT_POSITION)
    {
        if (self::CURRENT_POSITION === $position) {
            $position = $this->position;
        }

        $eolPosition = strpos($this->data, "\n", $position);
        if (false === $eolPosition) {
            $eolPosition = strlen($this->data) - 1;
        }

        return $eolPosition;
    }
609724
public function getChildren(MenuItem $parent = null)
    {
        if ($parent == null) {
            return $this->getTopChildren();
        }
        $result = [];
        foreach ($this->adaptors as $menuAdaptor) {
            $menuAdaptor->adaptChildren($this, $result, $parent, $this->getRequest());
        }

        return $result;
    }
752416
public function get_items() {
        global $CFG;
        $items = array();
        // Make sure that navigation is initialised
        if (!$this->has_items()) {
            return $items;
        }
        if ($this->items !== null) {
            return $this->items;
        }

        if (count($this->children) > 0) {
            // Add the custom children.
            $items = array_reverse($this->children);
        }

        // Check if navigation contains the active node
        if (!$this->ignoreactive) {
            // We will need to ensure the navigation has been initialised.
            $this->page->navigation->initialise($this->page);
            // Now find the active nodes on both the navigation and settings.
            $navigationactivenode = $this->page->navigation->find_active_node();
            $settingsactivenode = $this->page->settingsnav->find_active_node();

            if ($navigationactivenode && $settingsactivenode) {
                // Parse a combined navigation tree
                while ($settingsactivenode && $settingsactivenode->parent !== null) {
                    if (!$settingsactivenode->mainnavonly) {
                        $items[] = new breadcrumb_navigation_node($settingsactivenode);
                    }
                    $settingsactivenode = $settingsactivenode->parent;
                }
                if (!$this->includesettingsbase) {
                    // Removes the first node from the settings (root node) from the list
                    array_pop($items);
                }
                while ($navigationactivenode && $navigationactivenode->parent !== null) {
                    if (!$navigationactivenode->mainnavonly) {
                        $items[] = new breadcrumb_navigation_node($navigationactivenode);
                    }
                    if (!empty($CFG->navshowcategories) &&
                            $navigationactivenode->type === self::TYPE_COURSE &&
                            $navigationactivenode->parent->key === 'currentcourse') {
                        foreach ($this->get_course_categories() as $item) {
                            $items[] = new breadcrumb_navigation_node($item);
                        }
                    }
                    $navigationactivenode = $navigationactivenode->parent;
                }
            } else if ($navigationactivenode) {
                // Parse the navigation tree to get the active node
                while ($navigationactivenode && $navigationactivenode->parent !== null) {
                    if (!$navigationactivenode->mainnavonly) {
                        $items[] = new breadcrumb_navigation_node($navigationactivenode);
                    }
                    if (!empty($CFG->navshowcategories) &&
                            $navigationactivenode->type === self::TYPE_COURSE &&
                            $navigationactivenode->parent->key === 'currentcourse') {
                        foreach ($this->get_course_categories() as $item) {
                            $items[] = new breadcrumb_navigation_node($item);
                        }
                    }
                    $navigationactivenode = $navigationactivenode->parent;
                }
            } else if ($settingsactivenode) {
                // Parse the settings navigation to get the active node
                while ($settingsactivenode && $settingsactivenode->parent !== null) {
                    if (!$settingsactivenode->mainnavonly) {
                        $items[] = new breadcrumb_navigation_node($settingsactivenode);
                    }
                    $settingsactivenode = $settingsactivenode->parent;
                }
            }
        }

        $items[] = new breadcrumb_navigation_node(array(
            'text' => $this->page->navigation->text,
            'shorttext' => $this->page->navigation->shorttext,
            'key' => $this->page->navigation->key,
            'action' => $this->page->navigation->action
        ));

        if (count($this->prependchildren) > 0) {
            // Add the custom children
            $items = array_merge($items, array_reverse($this->prependchildren));
        }

        $last = reset($items);
        if ($last) {
            $last->set_last(true);
        }
        $this->items = array_reverse($items);
        return $this->items;
    }
1261184
private function breadcrumbs($place): array
    {
        $breadcrumbs = [];
        if ($place->gedcomName() !== '') {
            $breadcrumbs[] = $place;
            $parent_place  = $place->parent();
            while ($parent_place->gedcomName() !== '') {
                $breadcrumbs[] = $parent_place;
                $parent_place  = $parent_place->parent();
            }
            $breadcrumbs = array_reverse($breadcrumbs);
            $current     = array_pop($breadcrumbs);
        } else {
            $current = '';
        }

        return [
            'breadcrumbs' => $breadcrumbs,
            'current'     => $current,
        ];
    }
667374
public function byPosition($position)
	{
		$position = strtolower($position);
		$result   = array();

		$modules = $this->all();

		$total = count($modules);
		for ($i = 0; $i < $total; $i++)
		{
			if ($modules[$i]->position == $position)
			{
				$result[] =& $modules[$i];
			}
		}

		if (count($result) == 0)
		{
			if ($this->outline())
			{
				$result[0] = $this->byName('mod_' . $position);
				$result[0]->title    = $position;
				$result[0]->content  = $position;
				$result[0]->position = $position;
			}
		}

		return $result;
	}
341436
public function menuLinks($menu = [])
    {
        if (empty($menu)) {
            $menu = $this->menu();
        }

        $links = [];

        foreach ($menu as $item) {
            if (!empty($item['children'])) {
                $links = array_merge($links, $this->menuLinks($item['children']));
            } else {
                $links[] = Arr::only($item, ['title', 'uri', 'icon']);
            }
        }

        return $links;
    }
480068
public function getItems(): array
    {
        $available = [];
        $assigned = [];

        if ($this->type == Item::TYPE_ROLE) {
            foreach (array_keys($this->manager->getRoles()) as $name) {
                $available[$name] = 'role';
            }
        }
        foreach (array_keys($this->manager->getPermissions()) as $name) {
            $available[$name] = $name[0] == '/' ? 'route' : 'permission';
        }

        foreach ($this->manager->getChildren($this->_item->name) as $item) {
            $assigned[$item->name] = $item->type == 1 ? 'role' : ($item->name[0] == '/' ? 'route' : 'permission');
            unset($available[$item->name]);
        }

        unset($available[$this->name]);

        return [
            'available' => $available,
            'assigned' => $assigned,
        ];
    }
542183
private function getItems()
    {
        $items = [];

        $layer = $this->layerResolver->get();
        $filterList = $this->getFilterList();

        foreach ($filterList->getFilters($layer) as $filter) {
            if ($filter->getRequestVar() == $this->getFilterName()) {
                foreach ($filter->getItems() as $item) {
                    $item->setBaseUrl($this->_redirect->getRedirectUrl());
                    $items[] = $item->toArray(['url', 'count', 'is_selected', 'label']);
                }
            }
        }

        return $items;
    }
785679
public function getItems($force = false)
    {
        if (!$this->isBuiltIn() && ($this->nb_medioteca_item_list->isEmpty() || $force)) {
            $this->nb_medioteca_item_list = CNabuMediotecaItem::getItemsForMedioteca($this);
        }

        return $this->nb_medioteca_item_list;
    }
942814
public function getByPosition($position)
    {
        return isset($this->_entities[$position]) ? $this->_entities[$position] : null;
    }
1277624
public function getFlatSubItems()
    {
        $key = $this->getKey();
        $itemIds = Arr::get($this->_tree, $key);
        $flatItemIds = $this->_dot($itemIds, $key ? $key . '.' : '');
        $items = [];
        foreach ($flatItemIds as $itemId => $value) {
            $items[$itemId] = $this->_itemData[$itemId];
        }
        return $items;
    }
62304
public static function activeMenu($menu = null)
    {
        if ($menu === null) {
            $activeMenu = self::$_activeMenu;
        } else {
            $activeMenu = $menu;
        }

        if (!array_key_exists($activeMenu, self::$_items)) {
            self::$_items[$activeMenu] = [];
        }

        self::$_activeMenu = $activeMenu;
        return $activeMenu;
    }
870454
public function getMenuEntries($location = null)
    {
        $runtimeManager = $this->framework->getRuntimeManager();

        // Give the modules the opportunity to add additional menu entries
        $runtimeManager->executeEvent('\\Zepi\\Web\\General\\Event\\MenuManager\\RegisterAdditionalMenuEntries');
        
        if ($location === null) {
            return $this->menuEntries;
        }
        
        // If this location does not exists, return an empty array
        if (!isset($this->menuEntries[$location])) {
            return array();
        }
        
        // Execute the event
        $menuEntries = $runtimeManager->executeFilter('\\Zepi\\Web\\General\\Filter\\MenuManager\\FilterMenuEntries', $this->menuEntries[$location]);
        
        return $menuEntries;
    }
295217
public static function items($menu = 'sidebar', $items = null)
    {
        if (!is_string($menu)) {
            throw new \UnexpectedValueException('Menu id is not a string');
        }

        if (!empty($items)) {
            self::$_items[$menu] = $items;
        }

        if (!array_key_exists($menu, self::$_items)) {
            Log::error('Invalid menu: ' . $menu);
            return [];
        }

        return self::$_items[$menu];
    }
1015124
public function eq($position)
    {
        if (isset($this->nodes[$position])) {
            return $this->createSubCrawler($this->nodes[$position]);
        }

        return $this->createSubCrawler(null);
    }
281651
public function getNodeAt($position) {
        if (0 <= $position && $position <= count($this->nodes) - 1) {
            return $this->nodes[$position];
        }
        return null;
    }