src/services/CpNavService.php
public function setupDefaults($layoutId = 1)
    {
        $layoutService = CpNav::$plugin->layoutService;
        $navigationService = CpNav::$plugin->navigationService;

        if (!$layoutService->getById($layoutId)) {
            $layoutService->setDefaultLayout($layoutId);
        }

        // Populate navs with 'stock' navigation
        $navService = new Cp();
        $defaultNavs = $navService->nav();

        foreach ($defaultNavs as $nav) {
            $key = strtolower($nav['label']);

            if (!$navigationService->getByHandle($layoutId, $key)) {

                // Handleball off to the main menu regeneration function - no need to duplicate code
                $this->regenerateNav($layoutId, [], $defaultNavs);
            }
        }
    }
public function setupDefaults($layoutId = 1)
    {
        $layoutService = CpNav::$plugin->layoutService;
        $navigationService = CpNav::$plugin->navigationService;

        if (!$layoutService->getById($layoutId)) {
            $layoutService->setDefaultLayout($layoutId);
        }

        // Populate navs with 'stock' navigation
        $navService = new Cp();
        $defaultNavs = $navService->nav();

        foreach ($defaultNavs as $nav) {
            $key = strtolower($nav['label']);

            if (!$navigationService->getByHandle($layoutId, $key)) {

                // Handleball off to the main menu regeneration function - no need to duplicate code
                $this->regenerateNav($layoutId, [], $defaultNavs);
            }
        }
    }
public function setupDefaults ( $ layoutId = 1 ) { $ layoutService = CpNav :: $ plugin -> layoutService ; $ navigationService = CpNav :: $ plugin -> navigationService ; if ( ! $ layoutService -> getById ( $ layoutId ) ) { $ layoutService -> setDefaultLayout ( $ layoutId ) ; } // Populate navs with 'stock' navigation $ navService = new Cp ( ) ; $ defaultNavs = $ navService -> nav ( ) ; foreach ( $ defaultNavs as $ nav ) { $ key = strtolower ( $ nav [ 'label' ] ) ; if ( ! $ navigationService -> getByHandle ( $ layoutId , $ key ) ) { // Handleball off to the main menu regeneration function - no need to duplicate code $ this -> regenerateNav ( $ layoutId , [ ] , $ defaultNavs ) ; } } }
Create the default Layout after plugin is installed

@param integer $layoutId
Create the default Layout after plugin is installed