laravel-menus icon indicating copy to clipboard operation
laravel-menus copied to clipboard

Possible to make mega menu with it?

Open a-h-abid opened this issue 8 years ago • 3 comments

Is it possible to make Mega Menu with this package???

a-h-abid avatar Nov 30 '17 11:11 a-h-abid

Why not?

My idea for this is to use the dropdown element which will be used to group the links inside the mega menu.

noxify avatar Dec 01 '17 12:12 noxify

@noxify I guess I need to do some customize in a Custom Presenter. But it is not clear to me what to do. I mean, how can I tell it that I want this dropdown menu Mega Menu and this other dropdown one Usual Menu?

a-h-abid avatar Dec 02 '17 04:12 a-h-abid

I guess I need to do some customize in a Custom Presenter.

You're right.

But it is not clear to me what to do. I mean, how can I tell it that I want this dropdown menu Mega Menu and this other dropdown one Usual Menu?

In my idea, i have for example a mega menu with 4 columns. Based on the documentation, the menu definition looks something like this: ( https://nwidart.com/laravel-menus/v1/introduction )

Menu::create('megamenu', function($menu) {
    $menu->dropdown('Column 1', function ($sub) {
        $sub->header('First Column Headline');
        $sub->url('#', 'Link 1');
        $sub->url('#', 'Link 1');
        $sub->url('#', 'Link 1');
    }, 1);

    $menu->dropdown('Column 2', function ($sub) {
        $sub->header('Second Column Headline');
        $sub->url('#', 'Link 2');
        $sub->url('#', 'Link 2');
        $sub->url('#', 'Link 2');
    }, 2);

    $menu->dropdown('Column 3', function ($sub) {
        $sub->header('Third Column Headline');
        $sub->url('#', 'Link 3');
        $sub->url('#', 'Link 3');
        $sub->url('#', 'Link 3');
    }, 3);

    $menu->dropdown('Column 4', function ($sub) {
        $sub->header('Fourth Column Headline');
        $sub->url('#', 'Link 4');
        $sub->url('#', 'Link 4');
        $sub->url('#', 'Link 4');
    }, 4);
});

Now you "only" have to define your own presenter which returns the correct html for your mega menu.

Alternative you can define different menus instead of one menu. I think this is easier for the first run, but makes it a bit unflexible (for me), because you can't use the order functionality (as you can see in the example above).

noxify avatar Dec 02 '17 10:12 noxify