Module Menu documentation



  • Hi,

    I'm trying to make use of the menu module and have read the documentation. Unfortunately I don't get it to working.

    Menu Module version 1.17.0

    First is that I cannot find the 'config/packages/pingpong/menus/config.php' file.
    I can find 'config/menus.php' and 'config/menus.styles.php' tried to use them but no success.
    This is what I did:

    Created a '/Modules/Brand/Menu/MainMenu.php' class file with 'use Pingpong\Menus\Presenters\Presenter;' and 'class MainMenu extends Presenter'.
    Copied the example found in the documentation and modified it to my needs.
    I registered the menu in 'config/menus.php' and 'config/menus.styles.php' with the following line:
    'main-menu' => 'Modules\Brand\Menu\MainMenu',

    In my front-end first called Menu::render()
    <?php Menu::render('main-menu', 'Modules\Brand\Menu\MainMenu'); ?>
    followed by
    {!! Menu::get('main-menu') !!}

    Two thing are (not) hapening:

    1. Only one menu item is showing, I have added three items.
    2. My list style is not showing.

    See below my MainMenu class

    namespace Modules\Brand\Menu;
    use Pingpong\Menus\Presenters\Presenter;
    class MainMenu extends Presenter
    {
        public function getOpenTagWrapper() {
            return null; // Don't need opening
        }
        public function getCloseTagWrapper() {
            return null; // Don't need closing
        }
        public function getMenuWithoutDropdownWrapper($item) {
            return '<li class="menu-nav-item"><a href="' . $item->getUrl() . '" class="menu-nav-link' . $this->getActiveState($item) . '">' . $item->title . '</a></li>';
        }
        public function getActiveState($item){
            return \Request::is($item->getRequest()) ? ' menu-nav-link-active' : null;
        }
        public function getDividerWrapper() {
            return null; // No divider needed
        }
        public function getMenuWithDropDownWrapper($item) {
            return null; // No drop down possible
        }
    }
    

    What am I doing wrong? I hope someone can help.

    Edit: Forgot to mention, official pingpong/menu documentation is offline.
    Edit*: markdown for code applied

    Best regards,
    StanB


  • admin

    You can still read the documentations of pingpong packages here: https://github.com/pingpong-labs/docs

    Please also use the markdown code syntax to wrap you code in. (3 backticks `)



  • Thank you for referring to the pingpong docs. On the project I'm working on, this has no priority at the moment, therefor I will look into it some other time.


Log in to reply
 

Looks like your connection to AsgardCms was lost, please wait while we try to reconnect.