F
Filament5mo ago
IWBW

Infolist TextEntry is stripping my SVG icons

I have the following code in my resource:
RepeatableEntry::make('incompleteTasks')
->hiddenLabel()
->schema([
TextEntry::make('title')
->hiddenLabel()
->html()
->state(function (Task $record) {
return view('filament.pages.task-list-item', ['task' => $record]);
}),
// Other entries
]),
]),
RepeatableEntry::make('incompleteTasks')
->hiddenLabel()
->schema([
TextEntry::make('title')
->hiddenLabel()
->html()
->state(function (Task $record) {
return view('filament.pages.task-list-item', ['task' => $record]);
}),
// Other entries
]),
]),
Then I have this code in my view:
<p class="flex items-center text-muted text-gray-600 dark:text-gray-400 font-small mt-1">
<x-heroicon-o-clock class="h-4 w-4 me-1 text-primary-500" />Some stuff here | <x-lineawesome-user-tie-solid class="h-4 w-4 mx-1 text-primary-500" /> Other stuff here
</p>
<p class="flex items-center text-muted text-gray-600 dark:text-gray-400 font-small mt-1">
<x-heroicon-o-clock class="h-4 w-4 me-1 text-primary-500" />Some stuff here | <x-lineawesome-user-tie-solid class="h-4 w-4 mx-1 text-primary-500" /> Other stuff here
</p>
When I dd() the view, the icons are there in the HTML, but when the entry is rendered, they are not. Is there something I can turn off to stop that behavior? In case you are wondering, I'm not using the ViewEntry because I could not figure out how to share the current Task with the view. viewData() does not accept a closure
Solution:
record should be tasks.. did you try something like this? ```php RepeatableEntry::make('incompleteTasks') ->schema([...
Jump to solution
12 Replies
Dennis Koch
Dennis Koch5mo ago
Try to wrap the view in a new HtmlString(view(...)->render())
In case you are wondering, I'm not using the ViewEntry because I could not figure out how to share the current Task with the view. viewData() does not accept a closure
I think it's just $record or $getRecord() ? Or $this->record?
IWBW
IWBWOP5mo ago
Try to wrap the view in a new HtmlString(view(...)->render())
This did not work. I think it's because the icons are not being stripped by the closure. They seem to be removed by the TextEntry component.
I think it's just $record or $getRecord() ?
$getRecord() contains the parent model, in this case, Customer. I'm looping through tasks associated with a customer.
awcodes
awcodes5mo ago
Try ->html() on the TextEntry
IWBW
IWBWOP5mo ago
It already has that
awcodes
awcodes5mo ago
Sorry. Missed that. Have you tried using a ViewEntry instead seems weird to return a view as the state to me.
Dennis Koch
Dennis Koch5mo ago
He tried but didn’t know how to get the current repeater record. I am not sure either.
awcodes
awcodes5mo ago
Wow. It’s even on the question. I obviously don’t need to be helping anyone today. Sorry. Lol.
Solution
LeandroFerreira
LeandroFerreira5mo ago
record should be tasks.. did you try something like this?
RepeatableEntry::make('incompleteTasks')
->schema([
ViewEntry::make('title')
->view('custom-entry')
])
RepeatableEntry::make('incompleteTasks')
->schema([
ViewEntry::make('title')
->view('custom-entry')
])
<!-- custom-entry.blade.php -->
<div>
{{ $getRecord() }}
</div>
<!-- custom-entry.blade.php -->
<div>
{{ $getRecord() }}
</div>
Dennis Koch
Dennis Koch5mo ago
He tried. $getRecord() returns the customer
LeandroFerreira
LeandroFerreira5mo ago
It was supposed to be task 🤔
Dennis Koch
Dennis Koch5mo ago
Haven't verified
IWBW
IWBWOP5mo ago
Hold on. Let me try that again I'm sorry guys. I must have been doing something wrong. I've tried $getRecord() and now I'm getting the task. I'm sorry for wasting your time. Thanks for helping 🙏
Want results from more Discord servers?
Add your server