How do we overwrite all resource pages?
I'm trying to change how the heading works across all pages without editing them all. Tried using macro but this doesn't get called. Also tried aliasing the BasePage class. Is there another way?
4 Replies
In your main panel on AdminPanelProvider.php you might need to set
->brandName('Your Global Page Title')
Is that what you mean?
If this is the same issue that I had, the docs were very hard to find a good answer for this.Cheers but no I wanted to overwrite the
getHeading
method of all the resources.
https://github.com/filamentphp/filament/blob/abfe849627e90711671de488d3e3f1263ddb1466/packages/panels/src/Pages/BasePage.php#L71
bumpYou will probably have to extend the Edit and Create Record classes. I’m not sure that macros work to override existing methods. I could be wrong though.
I don't think marcos work like this. I would use a trait if it's something this common. You would still need to add it to each resource but you could probably modify the stubs for filament. Also, here's a nice little trick from @Zep Fietje to go along with it. https://x.com/zepfietje/status/1798660116020965810
Zep Fietje (@zepfietje) on X
Came up with a neat way of reusing @filamentphp render hooks. 💡
Instead of registering the hook in a service provider for given scopes, I moved it to the boot method of a trait.
Now any page that uses the HasFooterActions trait will automatically render the footer actions. 👌
Twitter