Mar 6, 2024
0
Level 63
Computed properties with Livewire 3
Hello,
I'm using a computed property with Livewire 3 and I notice that a string is encoded with htmlspecialchars.
#[Computed]
public function title()
{
return $this->form->state->id ? 'Editer l\'état' : 'Créer un nouvel état';
}
For example an apostrophe ' is transformed into ' and when I want to display the string on the screen in the blade template, ' is displayed instead of '.
If I don't use the computed property, it works fine.
I have tried htmlspecialchars_decode(), but it doesn't work. The only way is to display the string with {!! $string !!}, but I'd like to avoid this.
What I'd like is to use the computed property and that the string displays correctly on the screen.
How can I do that ?
Thanks for your help.
V
Please or to participate in this conversation.