public function addSubMenuItem(string $k, string $v = '', string $prefix = P)
    {
        // Check if may be added if disables
        if (!$this->isAddingItemsAllowed()) {
            return $this;
        }

        // set value as key if not provided
        if (!$v) {
            $v = $k;
        }

        // Check that menu for this submenu item exists
        if (!isset($this->_menu[$prefix])) {
            return $this;
        }

        // Check if submenu item already exists
        if (isset($this->_menu[$prefix][$k])) {
            return $this;
        }

        // Check if have access to main menu item
        if (!Users::getInstance()->checkAccess($prefix, $k)) {
            return $this;
        }

        // Make main menu as array to add submenu items
        if (!is_array($this->_menu[$prefix])) {
            $this->_menu[$prefix] = [
                $prefix => $this->_menu[$prefix],
            ];
        }

        // Add submenu item
        $this->_menu[$prefix][$k] = $v;

        return $this;
    }
public function addSubMenuItem(string $k, string $v = '', string $prefix = P)
    {
        // Check if may be added if disables
        if (!$this->isAddingItemsAllowed()) {
            return $this;
        }

        // set value as key if not provided
        if (!$v) {
            $v = $k;
        }

        // Check that menu for this submenu item exists
        if (!isset($this->_menu[$prefix])) {
            return $this;
        }

        // Check if submenu item already exists
        if (isset($this->_menu[$prefix][$k])) {
            return $this;
        }

        // Check if have access to main menu item
        if (!Users::getInstance()->checkAccess($prefix, $k)) {
            return $this;
        }

        // Make main menu as array to add submenu items
        if (!is_array($this->_menu[$prefix])) {
            $this->_menu[$prefix] = [
                $prefix => $this->_menu[$prefix],
            ];
        }

        // Add submenu item
        $this->_menu[$prefix][$k] = $v;

        return $this;
    }
public function addSubMenuItem ( string $ k , string $ v = '' , string $ prefix = P ) { // Check if may be added if disables if ( ! $ this -> isAddingItemsAllowed ( ) ) { return $ this ; } // set value as key if not provided if ( ! $ v ) { $ v = $ k ; } // Check that menu for this submenu item exists if ( ! isset ( $ this -> _menu [ $ prefix ] ) ) { return $ this ; } // Check if submenu item already exists if ( isset ( $ this -> _menu [ $ prefix ] [ $ k ] ) ) { return $ this ; } // Check if have access to main menu item if ( ! Users :: getInstance ( ) -> checkAccess ( $ prefix , $ k ) ) { return $ this ; } // Make main menu as array to add submenu items if ( ! is_array ( $ this -> _menu [ $ prefix ] ) ) { $ this -> _menu [ $ prefix ] = [ $ prefix => $ this -> _menu [ $ prefix ] , ] ; } // Add submenu item $ this -> _menu [ $ prefix ] [ $ k ] = $ v ; return $ this ; }
Add submenu item

@param string $k      to use in links
@param string $v      representation in submenu
@param string $prefix to know to which main menu item goes current submenu item

@return $this
Add submenu item