Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submenu won't show it parent element has route with parameters #2940

Closed
erimeilis opened this issue Jan 23, 2025 · 1 comment
Closed

Submenu won't show it parent element has route with parameters #2940

erimeilis opened this issue Jan 23, 2025 · 1 comment
Assignees
Labels

Comments

@erimeilis
Copy link

Describe the bug
If we have parameters in route, that neight on this route with parameters, no without we won't see child menu

To Reproduce
Steps to reproduce the behavior:

Menu::make('Test Param')
                ->slug('basket-dids-manual')
                ->list([
                    Menu::make('Test')
                        ->route('platform.test.list'),
                ])
                ->route('platform.test-param.list', '?type=1'),

Expected behavior
An "active" class should add to menu element by route core

@tabuna
Copy link
Member

tabuna commented Jan 27, 2025

By default, menu item activity is determined based on the following pattern:

$href,  
$href.'?*',  
$href.'/*',  

You can define your own activity rules explicitly using the active method. For example:

Menu::make()->active([
    route('platform.test-param.list'). '*'  
    // Or any rules  
])  

Additionally, the route definition seems a bit unusual. Typically, the second parameter should be specified as an array with keys. For example:

->route('platform.test-param.list', [
   'type' => 1,
]),

@tabuna tabuna closed this as completed Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants