Fill modal infolist from array
Hi all.
I'm using a Table row action to display data from another record in a modal.
With forms, I can use an action's
->fillForm()
method to populate the modal's ->form()
. Is there a way to do the same for a modal's ->infolist()
?Solution:Jump to solution
Answer: use a closure in
->infolist()
and pass the custom data to the infolist using ->state()
2 Replies
Solution
Answer: use a closure in
->infolist()
and pass the custom data to the infolist using ->state()
Hello, Can You share some code ? I'm strugling with this as well.
this works:
Tables\Actions\Action::make('Adresy')
->modalFooterActions(fn() => [])->hiddenLabel()->tooltip('Adres dostawy')->icon('heroicon-o-map-pin')->infolist(
function (?Model $record, Infolist $infolist) {
$addresses = [ 0 => ['default' => 1, 'adr_Nazwa' => 'test'] ];
return $infolist->state(['addresses' => $addresses])->schema(
[
RepeatableEntry::make('addresses')->schema([
IconEntry::make('default')->boolean()->label('Domyślny'),
TextEntry::make('adr_Nazwa'),
]
)]);})->slideOver(),