src/Charcoal/Admin/AdminTemplate.php
protected function createMainMenu($options = null)
    {
        $mainMenuConfig = $this->adminConfig('main_menu');

        if (!isset($mainMenuConfig['items'])) {
            throw new InvalidArgumentException(
                'Missing "admin.main_menu.items"'
            );
        }

        $mainMenuIdent = $this->mainMenuIdent($options);

        $menu = $this->menuBuilder->build([]);
        $menuItems = [];
        foreach ($mainMenuConfig['items'] as $menuIdent => $menuItem) {
            $menuItem['menu'] = $menu;
            $test = $this->menuItemBuilder->build($menuItem);

            if ($test->isAuthorized() === false) {
                continue;
            }
            unset($menuItem['menu']);

            if (isset($menuItem['active']) && $menuItem['active'] === false) {
                continue;
            }

            $menuItems[] = $this->parseMainMenuItem($menuItem, $menuIdent, $mainMenuIdent);
        }

        return $menuItems;
    }
protected function createMainMenu($options = null)
    {
        $mainMenuConfig = $this->adminConfig('main_menu');

        if (!isset($mainMenuConfig['items'])) {
            throw new InvalidArgumentException(
                'Missing "admin.main_menu.items"'
            );
        }

        $mainMenuIdent = $this->mainMenuIdent($options);

        $menu = $this->menuBuilder->build([]);
        $menuItems = [];
        foreach ($mainMenuConfig['items'] as $menuIdent => $menuItem) {
            $menuItem['menu'] = $menu;
            $test = $this->menuItemBuilder->build($menuItem);

            if ($test->isAuthorized() === false) {
                continue;
            }
            unset($menuItem['menu']);

            if (isset($menuItem['active']) && $menuItem['active'] === false) {
                continue;
            }

            $menuItems[] = $this->parseMainMenuItem($menuItem, $menuIdent, $mainMenuIdent);
        }

        return $menuItems;
    }
protected function createMainMenu ( $ options = null ) { $ mainMenuConfig = $ this -> adminConfig ( 'main_menu' ) ; if ( ! isset ( $ mainMenuConfig [ 'items' ] ) ) { throw new InvalidArgumentException ( 'Missing "admin.main_menu.items"' ) ; } $ mainMenuIdent = $ this -> mainMenuIdent ( $ options ) ; $ menu = $ this -> menuBuilder -> build ( [ ] ) ; $ menuItems = [ ] ; foreach ( $ mainMenuConfig [ 'items' ] as $ menuIdent => $ menuItem ) { $ menuItem [ 'menu' ] = $ menu ; $ test = $ this -> menuItemBuilder -> build ( $ menuItem ) ; if ( $ test -> isAuthorized ( ) === false ) { continue ; } unset ( $ menuItem [ 'menu' ] ) ; if ( isset ( $ menuItem [ 'active' ] ) && $ menuItem [ 'active' ] === false ) { continue ; } $ menuItems [ ] = $ this -> parseMainMenuItem ( $ menuItem , $ menuIdent , $ mainMenuIdent ) ; } return $ menuItems ; }
Create the main menu using the admin config.

@param  mixed $options The main menu widget ID or config.
@throws InvalidArgumentException If the admin config is missing, invalid, or malformed.
@return array
Create the main menu using the admin config .