src/Menu.php
public function addMenu($name)
    {
        if (is_array($name)) {
            $label = $name[0];
            unset($name[0]);
        } else {
            $label = $name;
            $name = [];
        }

        $sub_menu = $this->add([new self(), 'defaultTemplate' => 'submenu.html', 'ui' => 'dropdown', 'in_dropdown' => true]);
        $sub_menu->set('label', $label);

        if (isset($name['icon']) && $name['icon']) {
            $sub_menu->add(new Icon($name['icon']), 'Icon')->removeClass('item');
        }

        if (!$this->in_dropdown) {
            $sub_menu->js(true)->dropdown(['on' => 'hover', 'action' => 'hide']);
        }

        return $sub_menu;
    }
public function addMenu($name)
    {
        if (is_array($name)) {
            $label = $name[0];
            unset($name[0]);
        } else {
            $label = $name;
            $name = [];
        }

        $sub_menu = $this->add([new self(), 'defaultTemplate' => 'submenu.html', 'ui' => 'dropdown', 'in_dropdown' => true]);
        $sub_menu->set('label', $label);

        if (isset($name['icon']) && $name['icon']) {
            $sub_menu->add(new Icon($name['icon']), 'Icon')->removeClass('item');
        }

        if (!$this->in_dropdown) {
            $sub_menu->js(true)->dropdown(['on' => 'hover', 'action' => 'hide']);
        }

        return $sub_menu;
    }
public function addMenu ( $ name ) { if ( is_array ( $ name ) ) { $ label = $ name [ 0 ] ; unset ( $ name [ 0 ] ) ; } else { $ label = $ name ; $ name = [ ] ; } $ sub_menu = $ this -> add ( [ new self ( ) , 'defaultTemplate' => 'submenu.html' , 'ui' => 'dropdown' , 'in_dropdown' => true ] ) ; $ sub_menu -> set ( 'label' , $ label ) ; if ( isset ( $ name [ 'icon' ] ) && $ name [ 'icon' ] ) { $ sub_menu -> add ( new Icon ( $ name [ 'icon' ] ) , 'Icon' ) -> removeClass ( 'item' ) ; } if ( ! $ this -> in_dropdown ) { $ sub_menu -> js ( true ) -> dropdown ( [ 'on' => 'hover' , 'action' => 'hide' ] ) ; } return $ sub_menu ; }
Adds sub-menu.

@param string|array $name

@return Menu
Adds sub - menu .