Closed ghost closed 9 years ago
Sorry, looks like I forgot to write the documentation on this! It's simple though:
Creating our initial menu:
Menu::make('example', function($menu) {
$menu->add('Link 1', '/link-1');
$menu->add('Link 2', '/link-2);
});
Somewhere else (in a controller, for instance):
$menu = Menu::get('example');
$menu->add('Link 3', '/link-3');
$menu->add('Link 4', '/link-4');
And from an service provider? It's possible ?
Background:
I've use the Skylabs Module Plugin and each modules should have the possibilty to register a menu point. The menu service provider is located in Core Module.
Current value is "null". Within the Controller all okay.
Yes, that is certainly possible (and the best location, imho)! Just be sure that your menu is created before trying to get()
it and add items to it.
Okay, it’s functional.
How can I use sub menu points ?
Von: Shea Lewis [mailto:notifications@github.com] Gesendet: Donnerstag, 30. April 2015 01:33 An: caffeinated/menus Cc: virtualstep Betreff: Re: [menus] Add new item from controller (#27)
Yes, that is certainly possible (and the best location, imho)! Just be sure that your menu is created before trying to get() it and add items to it.
— Reply to this email directly or view it on GitHub https://github.com/caffeinated/menus/issues/27#issuecomment-97614034 . https://github.com/notifications/beacon/AKNhIOC_3BtR93rIHEnqsHes8tEvF2Ydks5oEWGjgaJpZM4EL4Fq.gif
I find It out.
Add this please to your doc.
$menu->add('Blog', 'blog'); $menu->blog->add('Blog 2', 'blog');
Documentation on adding menu items can be found here now: https://github.com/caffeinated/menus/wiki/Basics-of-Menu-Items
Good evening,
how can I add a new menu item to an existing menu instance within the controller ?
Sorry for my bad english. I'm German.
Greetings,