HTML for getTableEmptyStateDescription

How to put html string when empty state?
9 Replies
vahnmarty
vahnmartyOP17mo ago
No. Like this:
protected function getTableEmptyStateDescription(): ?string
{
return 'Create a parent record using the form below.';
}
protected function getTableEmptyStateDescription(): ?string
{
return 'Create a parent record using the form below.';
}
From this https://filamentphp.com/docs/2.x/tables/getting-started#empty-state
vahnmarty
vahnmartyOP17mo ago
So instead of that string, be html like Create a <strong>parent record</strong>...
LeandroFerreira
LeandroFerreira17mo ago
sorry can you try something like this?
return new HtmlString('<span>Create a parent record using the form below.</span>');
return new HtmlString('<span>Create a parent record using the form below.</span>');
vahnmarty
vahnmartyOP17mo ago
It doesn't work. @Leandro Ferreira
vahnmarty
vahnmartyOP17mo ago
Yuut4
Yuut417mo ago
do you want to remove the tags? did not quite understand ? if so you can use
strip_tags()
strip_tags()
if I'm not mistaken
vahnmarty
vahnmartyOP17mo ago
2nd ss is using <strong> , it should "bold" the word "child".
vahnmarty
vahnmartyOP17mo ago
This is because the filaments/.../table/index.blade.php is using {{ }} and not {!! !!}
<x-slot name="description">
{{ $getEmptyStateDescription() }}
</x-slot>
<x-slot name="description">
{{ $getEmptyStateDescription() }}
</x-slot>
hmm, I guess I'm going to use getEmptyState() ? This what worked for me and did some experiments. I hope someone could tell me if it there's a better idea.
public function getTableEmptyState(): ?View
{
return view('filament.tables.empty-state');
}
public function getTableEmptyState(): ?View
{
return view('filament.tables.empty-state');
}
Want results from more Discord servers?
Add your server