View Menu by Section

Is it possible to call elgg_view_menu for just one menu section? Or as I'm trying to do, view the items not listed in a section?

As to why - I'm basically merging header and topbar and only want to load part of the topbar menu for logged in users.

 

  • shud think so ->
    (a) elgg_register_menu_item ('whatever',...) = followed by
    (b) elgg_view_menu ('whatever',...)

    and ' An additional hook is the 'prepare', 'menu:<menu name>' which enables plugins
     * to modify the structure of the menu (sort it, remove items, set variables on
     * the menu items) ' [@core comments]

     

  • Something like this will work

            elgg_register_menu_item('topbar', array(
                'name' => '......',
                'href' => "/.....",
                'text' => elgg_echo('.....'),
                'priority' => 101,
                'section' => 'alt',
            ));

  • Thanks for your help.

    I have the "alt" section setup, but I don't know how to view the menu without viewing all sections, I just want the one. I understand I can "prepare" the menu, but don't know how to go about doing so.

  • Just realised it's even simpler than that, just put a condition around the original elgg_register_menu - happy days, thanks.

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking