F
Filamentβ€’6mo ago
egmose5492dk

Filament Checkboxlist returns raw HTML

Im trying to make a dynamic checkboxlist. For each checkbox, i want to show an Font-Awesome icon. The issue is, that it just renders as a regular string. Any idea how to solve that? Tab::make('Faciliteter') ->schema([ Grid::make(1) ->schema([ CheckboxList::make('facilities') ->relationship('facilities', 'facility_name') ->getOptionLabelFromRecordUsing(function ($record) { return new HtmlString('<i class="fa fa-' . $record->facility_fa_icon . '"></i> ' . $record->facility_name); }) ->columns(5), ]), ]),
4 Replies
egmose5492dk
egmose5492dkβ€’6mo ago
No one with an idea? πŸ™‚
Dennis Koch
Dennis Kochβ€’6mo ago
The label probably doesn't support HtmlString and expects a string. You could create a PR to add support.
egmose5492dk
egmose5492dkβ€’6mo ago
Thx @Dennis Koch - I will try to see if i can figure out making the change.
Dennis Koch
Dennis Kochβ€’6mo ago
It's probably just the expected type of the property and return type of the methods that is set to string