F
Filament2mo ago
CT

Htmlable label causes "Alpine Expression Error: Invalid or unexpected token"

TextColumn::macro('abbr', function (string $abbr) {
$label = $this->getLabel();

$html = "<abbr class=\"underline decoration-dotted cursor-help\">{$label}</abbr>";

return $this
->label(new HtmlString($html))
->extraHeaderAttributes([
'x-tooltip.raw' => $abbr,
]);
});
TextColumn::macro('abbr', function (string $abbr) {
$label = $this->getLabel();

$html = "<abbr class=\"underline decoration-dotted cursor-help\">{$label}</abbr>";

return $this
->label(new HtmlString($html))
->extraHeaderAttributes([
'x-tooltip.raw' => $abbr,
]);
});
Everything displays fine and it works fine, but I keep getting the attached error in the console. I've tried every way I can think of to escape the quotes and I keep getting this error. Is this a Filament bug or am I doing something wrong? Thanks
No description
3 Replies
CT
CTOP2mo ago
Also, it seems HTML labels are escaped in the column visibility menu. Here's a comparison of v3 and v4. I've read the upgrade guide but can't see anything that would cause this... any ideas? Have tried the following also with the same result
$html = '<abbr class="underline decoration-dotted cursor-help">' . $escapedLabel . '</abbr>';
$html = '<abbr class="underline decoration-dotted cursor-help">' . $escapedLabel . '</abbr>';
No description
No description
Dennis Koch
Dennis Koch2mo ago
If this is a regression in v4, please open an issue on GitHub
YuXin Zhai
YuXin Zhai2mo ago
Same code, no problem with v3

Did you find this page helpful?