Replies: 1 comment
-
You can inject use Filament\Forms\Components\Component;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\HtmlString;
...
public function boot(): void
{
Component::configureUsing(function (Component $component) {
if ($component instanceof TextInput or $component instanceof Select) {
$component->hint(fn (Component $component) => new HtmlString(Blade::render('<x-filament::loading-indicator class=\'h-5 w-5\' wire:loading wire:target=\''.$component->getId().'\' />')));
}
});
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Package
Panel builder
Package Version
3.2
How can we help you?
I'm looking for a way to retrieve the dynamic field ID or the wire:model of a Filament field.
For a regular field, I can easily use data.fieldname. However, in a repeater field, the field ID is dynamic and changes every time the page is loaded.
Here’s my code:
Normal Field:
TextInput::make( 'textname' )
->hint( self::fieldLoading( $GETFIELDID or FIELDWIREMODEL ) )
Repeater Field:
Repeater::make('members')
->schema([
TextInput::make('textname')
->hint( self::fieldLoading( $GETFIELDID or FIELDWIREMODEL ) ),
Select::make('selectname')
->hint( self::fieldLoading( $GETFIELDID or FIELDWIREMODEL ) ),
->options( [
'option 1' => 'Option 1',
'option 2' => 'Option 2',
'option 3' => 'Option 3',
] )
->required(),
])
public static function fieldLoading( $fieldName )
{
return new HtmlString( Blade::render( "<x-filament::loading-indicator class='h-5 w-5' wire:loading wire:target='{$fieldName}' />" ) );
}
Beta Was this translation helpful? Give feedback.
All reactions