classes/Layout/Nav.php
public function generate()
    {
        // Get the navigation pages from the config
        $pages = Config::get('decoy.site.nav');
        if (is_callable($pages)) {
            $pages = call_user_func($pages);
        }

        // Loop through the list of pages and massage
        $massaged = [];
        foreach ($pages as $key => $val) {

            // If val is an array, make a drop down menu
            if (is_array($val)) {

                // Create a new page instance that represents the dropdown menu
                $page = ['active' => false];
                $page = array_merge($page, $this->makeIcon($key));
                $page['children'] = [];

                // Loop through children (we only support one level deep) and
                // add each as a child
                foreach ($val as $child_key => $child_val) {
                    $page['children'][] = $this->makePage($child_key, $child_val);
                }

                // See if any of the children are active and set the pulldown to active
                foreach ($page['children'] as $child) {
                    if (!empty($child->active)) {
                        $page['active'] = true;
                        break;
                    }
                }

                // Add the pulldown to the list of pages
                $massaged[] = (object) $page;

            // The page is a simple (non pulldown) link
            } else {
                $massaged[] = $this->makePage($key, $val);
            }
        }

        // Pass along the navigation data
        return $massaged;
    }
public function generate()
    {
        // Get the navigation pages from the config
        $pages = Config::get('decoy.site.nav');
        if (is_callable($pages)) {
            $pages = call_user_func($pages);
        }

        // Loop through the list of pages and massage
        $massaged = [];
        foreach ($pages as $key => $val) {

            // If val is an array, make a drop down menu
            if (is_array($val)) {

                // Create a new page instance that represents the dropdown menu
                $page = ['active' => false];
                $page = array_merge($page, $this->makeIcon($key));
                $page['children'] = [];

                // Loop through children (we only support one level deep) and
                // add each as a child
                foreach ($val as $child_key => $child_val) {
                    $page['children'][] = $this->makePage($child_key, $child_val);
                }

                // See if any of the children are active and set the pulldown to active
                foreach ($page['children'] as $child) {
                    if (!empty($child->active)) {
                        $page['active'] = true;
                        break;
                    }
                }

                // Add the pulldown to the list of pages
                $massaged[] = (object) $page;

            // The page is a simple (non pulldown) link
            } else {
                $massaged[] = $this->makePage($key, $val);
            }
        }

        // Pass along the navigation data
        return $massaged;
    }
public function generate ( ) { // Get the navigation pages from the config $ pages = Config :: get ( 'decoy.site.nav' ) ; if ( is_callable ( $ pages ) ) { $ pages = call_user_func ( $ pages ) ; } // Loop through the list of pages and massage $ massaged = [ ] ; foreach ( $ pages as $ key => $ val ) { // If val is an array, make a drop down menu if ( is_array ( $ val ) ) { // Create a new page instance that represents the dropdown menu $ page = [ 'active' => false ] ; $ page = array_merge ( $ page , $ this -> makeIcon ( $ key ) ) ; $ page [ 'children' ] = [ ] ; // Loop through children (we only support one level deep) and // add each as a child foreach ( $ val as $ child_key => $ child_val ) { $ page [ 'children' ] [ ] = $ this -> makePage ( $ child_key , $ child_val ) ; } // See if any of the children are active and set the pulldown to active foreach ( $ page [ 'children' ] as $ child ) { if ( ! empty ( $ child -> active ) ) { $ page [ 'active' ] = true ; break ; } } // Add the pulldown to the list of pages $ massaged [ ] = ( object ) $ page ; // The page is a simple (non pulldown) link } else { $ massaged [ ] = $ this -> makePage ( $ key , $ val ) ; } } // Pass along the navigation data return $ massaged ; }
Generate the nav config

@return array
Generate the nav config