public function addRootPage()
    {
        $identifier = $this->getModel()->getIdentifier();

        // Check page
        if (!$this->getModel()->hasPage($identifier)) {
            throw new AdminPageException(sprintf(Translate::t('adminpage.errors.page_is_empty'), $identifier));
        }

        // Set default option's values
        $defaults = [
            'slug'          => $identifier,

            // Page options
            'title'         => Translate::t('adminpage.root.defaults.title'),
            'name'          => Translate::t('adminpage.root.defaults.name'),
            'icon'          => 'dashicons-admin-generic',
            'description'   => '',
            'position'      => 80,
            'sections'      => [],

            // Options
            'capabilities'  => OL_ZEUS_WP_CAP,
            'adminbar'      => true,
            'submit'        => true,
        ];

        // Update pages
        $options = $this->getModel()->getPages($identifier);
        $options = array_merge($defaults, $options);
        $this->getModel()->updatePage($identifier, $options);

        // Add main page
        add_menu_page(
            $options['title'],
            $options['name'],
            $options['capabilities'],
            $identifier,
            [&$this, 'callback'],
            $options['icon'],
            $options['position']
        );

        // Add admin bar menu
        if ($options['adminbar']) {
            $this->addRootAdminBar();
        }
    }
public function addRootPage()
    {
        $identifier = $this->getModel()->getIdentifier();

        // Check page
        if (!$this->getModel()->hasPage($identifier)) {
            throw new AdminPageException(sprintf(Translate::t('adminpage.errors.page_is_empty'), $identifier));
        }

        // Set default option's values
        $defaults = [
            'slug'          => $identifier,

            // Page options
            'title'         => Translate::t('adminpage.root.defaults.title'),
            'name'          => Translate::t('adminpage.root.defaults.name'),
            'icon'          => 'dashicons-admin-generic',
            'description'   => '',
            'position'      => 80,
            'sections'      => [],

            // Options
            'capabilities'  => OL_ZEUS_WP_CAP,
            'adminbar'      => true,
            'submit'        => true,
        ];

        // Update pages
        $options = $this->getModel()->getPages($identifier);
        $options = array_merge($defaults, $options);
        $this->getModel()->updatePage($identifier, $options);

        // Add main page
        add_menu_page(
            $options['title'],
            $options['name'],
            $options['capabilities'],
            $identifier,
            [&$this, 'callback'],
            $options['icon'],
            $options['position']
        );

        // Add admin bar menu
        if ($options['adminbar']) {
            $this->addRootAdminBar();
        }
    }
public function addRootPage ( ) { $ identifier = $ this -> getModel ( ) -> getIdentifier ( ) ; // Check page if ( ! $ this -> getModel ( ) -> hasPage ( $ identifier ) ) { throw new AdminPageException ( sprintf ( Translate :: t ( 'adminpage.errors.page_is_empty' ) , $ identifier ) ) ; } // Set default option's values $ defaults = [ 'slug' => $ identifier , // Page options 'title' => Translate :: t ( 'adminpage.root.defaults.title' ) , 'name' => Translate :: t ( 'adminpage.root.defaults.name' ) , 'icon' => 'dashicons-admin-generic' , 'description' => '' , 'position' => 80 , 'sections' => [ ] , // Options 'capabilities' => OL_ZEUS_WP_CAP , 'adminbar' => true , 'submit' => true , ] ; // Update pages $ options = $ this -> getModel ( ) -> getPages ( $ identifier ) ; $ options = array_merge ( $ defaults , $ options ) ; $ this -> getModel ( ) -> updatePage ( $ identifier , $ options ) ; // Add main page add_menu_page ( $ options [ 'title' ] , $ options [ 'name' ] , $ options [ 'capabilities' ] , $ identifier , [ & $ this , 'callback' ] , $ options [ 'icon' ] , $ options [ 'position' ] ) ; // Add admin bar menu if ( $ options [ 'adminbar' ] ) { $ this -> addRootAdminBar ( ) ; } }
Add root admin page.
Add root admin page .