How to read the lang file/translation when registering navigationItems in a panel?
E.g this displays the 'filament-panels::layout.actions.billing.label' instead of the translated label.
Another issue when registering a custom navigation you've unable to use the resource
getUrl
method. This used to work in v2 but getting an error that the panel has not been setup yet.
Call to a member function getId() on nullRedirects is a custom list resource page which needs registering manually Tried to manually use
route()
helper function instead of the getting the resources but that does not work either.
Route [filament.admin.resources.products.index] not defined.Confirmed the route name is correct and visible when I run
php artisan route:list
.
Adding debug code to test the routes collection is empty at the point of registering the panel configuration dd(Route::getRoutes());
Solution:Jump to solution
Got it working in the end cheers for the help guys!
I found that I needed to update all calls to the label/group language calls otherwise it broke them all. Took a lot of trial and error with loads of coffee...
5 Replies
Have you tried a closure for the label? e.g.
->label(fn () => __('filament-panels::layout.actions.billing.label'))
If it’s showing the translation key that means there is no key set it the translations for it.
For the null current panel, make sure you have at least one of your panels set with ->default() especially if you only have one panel.
Cheers guys using a closer for the URL has fixed that issue. But still getting the label issue even when inside a closer.
It works fine when everything is cached - only an issue when clearing the cache:
Testing futher
- Works fine in a standalone project loading the local language file.
- It's only issue when loading language from other the current package or another package
My package name beings with a 'c' so it looks to be a problem loading the language file of that package and any below that alphabetically.
Solution
Got it working in the end cheers for the help guys!
I found that I needed to update all calls to the label/group language calls otherwise it broke them all. Took a lot of trial and error with loads of coffee
Hey guys.
I have the following error when clicking the button to impersonate
Call to undefined method Filament\FilamentManager::getCurrentPanel()
Has anyone ever get this problem?