FilamentF
Filament3y ago
Vp

How to return array in renderhook

I have renderhook I register like below in panel, and it's working
->renderHook(
    'panels::head.start', fn (): View => view('abc'),
)
->renderHook(
    'panels::global-search.before', fn (): string => Blade::render('@livewire(\'abc\')'),
)
->renderHook(
    'panels::global-search.after', fn (): View => view('xyz'),
)

But it look kind of repeat, I can see that ->renderHook accept array, but I cannot make it working. How can I convert all my renderhook inside one ->renderHook()

Note: Now I only post 3, but in actual I have around 7 of them
Solution
the hook name is always string, the array is for scopes
so if these hooks for different areas you need to repeat it
Was this page helpful?