Refactor SVG handling for loading indicator#19435
Refactor SVG handling for loading indicator#19435Shaharyar-WebDev wants to merge 3 commits intofilamentphp:4.xfrom
Conversation
danharrin
left a comment
There was a problem hiding this comment.
I don't think that a config file is suitable for this sort of change to be honest. How about we ask the user to bind an Htmlable object to the container via a specific interface from Filament, that receives the attributes object in the constructor?
940bfb9 to
1949990
Compare
Hi @danharrin, I've updated the implementation based on your feedback. Instead of a config string, the loading indicator is now resolved via Laravel's service container using a LoadingIndicator contract. Users can override it in their AppServiceProvider: Where CustomLoadingIndicator implements Filament\Support\Contracts\LoadingIndicator (which extends Htmlable) and receives the ComponentAttributeBag in its constructor. Backwards compatible — default behaviour is unchanged. Let me know what you think! |
6508b28 to
1477965
Compare
Refactor loading indicator SVG handling to use a custom SVG if configured, otherwise use default SVG.
Description
Refactored
generate_loading_indicator_html()to support a custom SVGloading indicator via the
filament.loading_indicator_svgconfig key.Previously, the SVG was hardcoded inline. Now the function:
config('filament.loading_indicator_svg')for a custom SVG string__attributes__placeholder with the resolvedComponentAttributeBagattributes (classes, wire:loading, etc.) andreturns that instead
This keeps full backwards compatibility — existing apps with no config
value set will see zero change in behaviour or appearance.
Visual changes
If a user sets
loading_indicator_svgintheir
filament.phpconfig, their chosen SVG will render in place ofthe default spinner.
See Visuals
Functional changes
composer cscommand.