get breadcrumbs in a render hook
how I can access breadcrumbs in a render hook
I want to move them to the topbar
and my view:
found this but where are the eggs π
$breadcrumbs
coming from!?
https://discord.com/channels/883083792112300104/883084832387760148/11410600614399877825 Replies
with the posted code I get
Undefined variable $breadcrumbs
it's never set!There's a breadcrumb blade component. Maybe you need to add it where you want to show them?
There should be a method on the page
Page::getBreadcrumbs()
. But I don't know how to access the current page in a render hook π
Yeah, the render hooks are disconnected from the page itself. A workaround I'm using to prepare data in the page and make it available to a render hook is the
View::share('name', 'value')
method. This effectively creates a global variable for all views, so use carefully (ie. add a a custom prefix or something)
This works because the page component and its Blade view gets rendered before the rest of the layout (logically...)thanks, the ui not an issue, the issue how to get
breadcrumbs
for the current page
that is the question π
this is a good idea. the problem is I think I have to send the page to a global var within every page or at least in every resource..
and I have some packages resources, cant do anything about it
thanks everyone, I guess I'll convince them it's better to keep the breadcrumbs in current place π