F
Filament12mo ago
Kleis

Dynamic text/header in RelationshipManager modal

Is there anyway we can achive a dynamic content for a PlaceHolder field, based on the current record (not the owner record) ? Ie. I want a header of sorts that is based on the data extracted in mountUsing()
return \Filament\Tables\Actions\Action::make('Anvendelse')
->mountUsing(function (Forms\ComponentContainer $form, \App\Models\Ownership $record) {
return $form->fill([
'test' => $record->created_at,
]);
})
->form(
[
Placeholder::make('apartment1')->content($rm->ownerRecord),
Forms\Components\TextInput::make('test'),
])
;
return \Filament\Tables\Actions\Action::make('Anvendelse')
->mountUsing(function (Forms\ComponentContainer $form, \App\Models\Ownership $record) {
return $form->fill([
'test' => $record->created_at,
]);
})
->form(
[
Placeholder::make('apartment1')->content($rm->ownerRecord),
Forms\Components\TextInput::make('test'),
])
;
Solution:
Figured it out... simple really 🫣
Placeholder::make('test')->content(function ($state) {return new HtmlString($state); }),
Placeholder::make('test')->content(function ($state) {return new HtmlString($state); }),
...
Jump to solution
5 Replies
Patrick Boivin
Patrick Boivin12mo ago
Sorry, what do you want to be displaying in your Placeholder?
gustavo_40405
gustavo_4040512mo ago
Hola Soy nuevo en filamentphp y lo estoy probando en un proyecto y la verdad no encuentro información en la documentación oficial ni en la red de como poder personalizar el $header, por Ejemplo tengo un Resource que se llama Client y coloca como título Clients, yo quisiera poder renombrarlo y que se llame Clientes.
Patrick Boivin
Patrick Boivin12mo ago
Por favor use el canal #es para soporte en español puedo tratar de ayudarlo
Kleis
Kleis12mo ago
In the example I would like to show the 'test' value in the placeholder. Real life the data would be a week number and date based on a custom query.
Solution
Kleis
Kleis12mo ago
Figured it out... simple really 🫣
Placeholder::make('test')->content(function ($state) {return new HtmlString($state); }),
Placeholder::make('test')->content(function ($state) {return new HtmlString($state); }),
With the test data filled using mountUsing