public function addChild($slug, $options)
    {
        $identifier = $this->getModel()->getIdentifier();

        // Check slug
        if (empty($slug)) {
            throw new AdminPageException(Translate::t('adminpage.errors.slug_is_not_defined'));
        }

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

            // Page options
            'title'         => Translate::t('adminpage.child.defaults.title'),
            'name'          => Translate::t('adminpage.child.defaults.name'),
            'description'   => '',
            'sections'      => [],

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

        // Merge options
        $options = array_merge($defaults, $options);
        $this->getModel()->updatePage($slug, $options);

        $pageid = $slug === $identifier ? $identifier : $identifier.'-'.$slug;

        // Add child page
        add_submenu_page(
            $identifier,
            $options['title'],
            $options['name'],
            $options['capabilities'],
            $pageid,
            [&$this, 'callback']
        );

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

        // Check slug
        if (empty($slug)) {
            throw new AdminPageException(Translate::t('adminpage.errors.slug_is_not_defined'));
        }

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

            // Page options
            'title'         => Translate::t('adminpage.child.defaults.title'),
            'name'          => Translate::t('adminpage.child.defaults.name'),
            'description'   => '',
            'sections'      => [],

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

        // Merge options
        $options = array_merge($defaults, $options);
        $this->getModel()->updatePage($slug, $options);

        $pageid = $slug === $identifier ? $identifier : $identifier.'-'.$slug;

        // Add child page
        add_submenu_page(
            $identifier,
            $options['title'],
            $options['name'],
            $options['capabilities'],
            $pageid,
            [&$this, 'callback']
        );

        // Add admin bar menu
        if ($options['adminbar']) {
            $this->addChildAdminBar($slug, $options);
        }
    }
public function addChild ( $ slug , $ options ) { $ identifier = $ this -> getModel ( ) -> getIdentifier ( ) ; // Check slug if ( empty ( $ slug ) ) { throw new AdminPageException ( Translate :: t ( 'adminpage.errors.slug_is_not_defined' ) ) ; } // Set default option's values $ defaults = [ 'slug' => $ slug , // Page options 'title' => Translate :: t ( 'adminpage.child.defaults.title' ) , 'name' => Translate :: t ( 'adminpage.child.defaults.name' ) , 'description' => '' , 'sections' => [ ] , // Options 'capabilities' => OL_ZEUS_WP_CAP , 'adminbar' => true , 'submit' => true , ] ; // Merge options $ options = array_merge ( $ defaults , $ options ) ; $ this -> getModel ( ) -> updatePage ( $ slug , $ options ) ; $ pageid = $ slug === $ identifier ? $ identifier : $ identifier . '-' . $ slug ; // Add child page add_submenu_page ( $ identifier , $ options [ 'title' ] , $ options [ 'name' ] , $ options [ 'capabilities' ] , $ pageid , [ & $ this , 'callback' ] ) ; // Add admin bar menu if ( $ options [ 'adminbar' ] ) { $ this -> addChildAdminBar ( $ slug , $ options ) ; } }
Add child admin page.

@param string    $slug
@param array     $options
Add child admin page .