Conditional Pageblock Dependent On Resource
Is there a way to only display a pageblock in a particular resource? I have this for example:
I only want this pageblock to be visible within the ComponentResource. Is this possible?
12 Replies
?
Thanks for the suggestion Leandro, but no luck with that. It doesn't display on any resource when I try that.
both get_called_class() and ComponentResource::class are the same value on the page I'm testing on, so I don't see why it shouldn't work. I also tried ->hidden !==
dont know if it exsist on a Block.
But try
Thanks Tieme but that doesn't work either
== instead of === ?
tried that also. No luck
->visible(str_contains(get_called_class(), 'ComponentResource'))
?doesn't work either
did you remove ->when() ?
yeah it's removed
and get_called_class() definitely returns "App\Filament\Resources\ComponentResource"
it should work
what's also weird is that if I have this:
it does display as an option
Forgot to put this in here but I used this as my solution:
I didn't want the exit popup to be an option for the pages section of the admin.