built in Widgets not configurable
widget's props are protected and there is no way to configure it
of course we can just extend it, but if there is an api like
configureUsing
it will be helpful and benefits plugins developer to provide customizationSolution:Jump to solution
to override widgets, you extend the class, make modifications, and register the new one
10 Replies
I agree with what you are saying, but since widgets are livewire components they can’t be instantiated and therefore can’t be configured like a class can.
I’m not getting livewire component can’t configure
You can't call say ProductWidget::make(), it's not possible with a livewire component.
Yeah understandable but I’m thinking of this way https://github.com/filamentphp/filament/blob/3.x/packages/support/src/Concerns/Configurable.php
GitHub
filament/packages/support/src/Concerns/Configurable.php at 3.x · fi...
Admin panel, form builder and table builder for Laravel. Built with the TALL stack. Designed for humans. - filamentphp/filament
It’s for blade component which is normal class, but this approach can’t apply to livewire?
I still don't think that would work. I'm interested if you can think of a way to do it though.
i copied the code from the Configurable trait and made some modifications
some things to note
- can't access protected properties
-
lazy
props is too late to override with this approach, unless livewire provide a class property or method instead of just blade properties
hey @Dan Harrin sorry for tagging you. but just want to highlight this idea if its something you would consider or already did, since if to make it work it would be breaking changes (protected -> public props) after v3 releaseno, i dont think i would consider this, sorry
its too hacky with Livewire interals IMO
Solution
to override widgets, you extend the class, make modifications, and register the new one
ok sure