F
Filament15mo ago
MAF

Visible and Hidden are not working on NavigationItem in NavigationBuilder array

For some reason, neither hidden() nor visible() is working!
public function panel(Panel $panel): Panel
{
return $panel
->navigation(function (NavigationBuilder $builder): NavigationBuilder {
return $builder->items([
NavigationItem::make('Menu Item')
->icon('heroicon-o-arrow-path')
->url(fn (): string => route('filament.admin.resources.products.being-processed'))
->isActiveWhen(fn (): bool => request()->routeIs('filament.admin.resources.products.being-processed'))
->visible(false)
->hidden(true)
]);
});
}
public function panel(Panel $panel): Panel
{
return $panel
->navigation(function (NavigationBuilder $builder): NavigationBuilder {
return $builder->items([
NavigationItem::make('Menu Item')
->icon('heroicon-o-arrow-path')
->url(fn (): string => route('filament.admin.resources.products.being-processed'))
->isActiveWhen(fn (): bool => request()->routeIs('filament.admin.resources.products.being-processed'))
->visible(false)
->hidden(true)
]);
});
}
2 Replies
MAF
MAFOP15mo ago
It works, when I append the following file and add @if($item->isVisible()) around <x-filament-panels::sidebar.item https://github.com/filamentphp/filament/blob/3.x/packages/panels/resources/views/components/sidebar/group.blade.php
GitHub
filament/packages/panels/resources/views/components/sidebar/group.b...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
MAF
MAFOP15mo ago
I created a pull request here which should solve the issue https://github.com/filamentphp/filament/pull/8553
GitHub
Respect isVisible() in NavigationItem by mabdelfattah · Pull Reques...
It is already well documented, but for some reason was not working/implemented. Changes have been thoroughly tested to not break existing functionality. New functionality has been documented or ...
Want results from more Discord servers?
Add your server