public function generate($plugin)
    {
        //Gets all menu name methods
        $methods = $this->getMenuMethods($plugin);

        if (empty($methods)) {
            return [];
        }

        $className = sprintf('%s.Menu', $plugin);

        //Loads the helper
        $helper = $this->_View->loadHelper($className, compact('className'));

        $menus = [];

        //Calls dynamically each method
        foreach ($methods as $method) {
            list($links, $title, $titleOptions) = call_user_func([$helper, $method]);

            if (empty($links) || empty($title)) {
                continue;
            }

            $menus[sprintf('%s.%s', $plugin, $method)] = compact('links', 'title', 'titleOptions');
        }

        return $menus;
    }
public function generate($plugin)
    {
        //Gets all menu name methods
        $methods = $this->getMenuMethods($plugin);

        if (empty($methods)) {
            return [];
        }

        $className = sprintf('%s.Menu', $plugin);

        //Loads the helper
        $helper = $this->_View->loadHelper($className, compact('className'));

        $menus = [];

        //Calls dynamically each method
        foreach ($methods as $method) {
            list($links, $title, $titleOptions) = call_user_func([$helper, $method]);

            if (empty($links) || empty($title)) {
                continue;
            }

            $menus[sprintf('%s.%s', $plugin, $method)] = compact('links', 'title', 'titleOptions');
        }

        return $menus;
    }
public function generate ( $ plugin ) { //Gets all menu name methods $ methods = $ this -> getMenuMethods ( $ plugin ) ; if ( empty ( $ methods ) ) { return [ ] ; } $ className = sprintf ( '%s.Menu' , $ plugin ) ; //Loads the helper $ helper = $ this -> _View -> loadHelper ( $ className , compact ( 'className' ) ) ; $ menus = [ ] ; //Calls dynamically each method foreach ( $ methods as $ method ) { list ( $ links , $ title , $ titleOptions ) = call_user_func ( [ $ helper , $ method ] ) ; if ( empty ( $ links ) || empty ( $ title ) ) { continue ; } $ menus [ sprintf ( '%s.%s' , $ plugin , $ method ) ] = compact ( 'links' , 'title' , 'titleOptions' ) ; } return $ menus ; }
Generates all menus for a plugin
@param string $plugin Plugin name
@return string|null Html code
@uses getMenuMethods()
Generates all menus for a plugin