src/tools/MbPage.php
public function addMenuWordpress()
    {
        if ($this->isHideMenu()) {

            add_submenu_page(
                null,
                $this->getName(),
                $this->getName(),
                $this->getCapability(),
                $this->getSlug(),
                [MocaBonita::getInstance(), 'sendContent']
            );

        } elseif ($this->isMainMenu()) {

            add_menu_page(
                $this->getName(),
                $this->getName(),
                $this->getCapability(),
                $this->getSlug(),
                [MocaBonita::getInstance(), 'sendContent'],
                $this->getDashicon(),
                $this->getMenuPosition()
            );

        } elseif ($this->isSubMenu()) {

            add_submenu_page(
                $this->getParentPage()->getSlug(),
                $this->getName(),
                $this->getName(),
                $this->getCapability(),
                $this->getSlug(),
                [MocaBonita::getInstance(), 'sendContent']
            );

            if ($this->getParentPage()->isRemovePageSubmenu()) {
                remove_submenu_page($this->getParentPage()->getSlug(), $this->getParentPage()->getSlug());
                $this->getParentPage()->setRemovePageSubmenu(false);
            }
        }

    }
public function addMenuWordpress()
    {
        if ($this->isHideMenu()) {

            add_submenu_page(
                null,
                $this->getName(),
                $this->getName(),
                $this->getCapability(),
                $this->getSlug(),
                [MocaBonita::getInstance(), 'sendContent']
            );

        } elseif ($this->isMainMenu()) {

            add_menu_page(
                $this->getName(),
                $this->getName(),
                $this->getCapability(),
                $this->getSlug(),
                [MocaBonita::getInstance(), 'sendContent'],
                $this->getDashicon(),
                $this->getMenuPosition()
            );

        } elseif ($this->isSubMenu()) {

            add_submenu_page(
                $this->getParentPage()->getSlug(),
                $this->getName(),
                $this->getName(),
                $this->getCapability(),
                $this->getSlug(),
                [MocaBonita::getInstance(), 'sendContent']
            );

            if ($this->getParentPage()->isRemovePageSubmenu()) {
                remove_submenu_page($this->getParentPage()->getSlug(), $this->getParentPage()->getSlug());
                $this->getParentPage()->setRemovePageSubmenu(false);
            }
        }

    }
public function addMenuWordpress ( ) { if ( $ this -> isHideMenu ( ) ) { add_submenu_page ( null , $ this -> getName ( ) , $ this -> getName ( ) , $ this -> getCapability ( ) , $ this -> getSlug ( ) , [ MocaBonita :: getInstance ( ) , 'sendContent' ] ) ; } elseif ( $ this -> isMainMenu ( ) ) { add_menu_page ( $ this -> getName ( ) , $ this -> getName ( ) , $ this -> getCapability ( ) , $ this -> getSlug ( ) , [ MocaBonita :: getInstance ( ) , 'sendContent' ] , $ this -> getDashicon ( ) , $ this -> getMenuPosition ( ) ) ; } elseif ( $ this -> isSubMenu ( ) ) { add_submenu_page ( $ this -> getParentPage ( ) -> getSlug ( ) , $ this -> getName ( ) , $ this -> getName ( ) , $ this -> getCapability ( ) , $ this -> getSlug ( ) , [ MocaBonita :: getInstance ( ) , 'sendContent' ] ) ; if ( $ this -> getParentPage ( ) -> isRemovePageSubmenu ( ) ) { remove_submenu_page ( $ this -> getParentPage ( ) -> getSlug ( ) , $ this -> getParentPage ( ) -> getSlug ( ) ) ; $ this -> getParentPage ( ) -> setRemovePageSubmenu ( false ) ; } } }
Add Menu in Wordpress

@return void
@throws MbException
Add Menu in Wordpress