At my company, we’re migrating Phalcon from version 4.2 to 5.4 while using PHP 7.4. We’re facing an issue with form initialization, specifically with the HTML inside labels being escaped.
We define our forms using Phalcon’s form component like this:
class CustomForm extends FormBase
{
// ...
$customfield = new Numeric('customfield');
$customfield->setLabel(ucwords($translations['keyi18n']) . ' <span title="Lorem" class="gv-tip"> <i class="fas fa-info-circle"></i></span>');
$this->add($customfield);
// ...
}
In our Volt template, we display the form as follows:
{{ form.label('customfield', ['class':'customclass']) }}
{{ form.render('customfield', ['class':'customclass']) }}
However, the label is rendered with escaped HTML, meaning the <span> and <i> tags appear as plain text :
<label for="customfield" class="customclass">keyi18n <span title="Lorem" class="gv-tip">&nbsp;<i class=" fas fa-info-circle"></i></span></label>
Things We’ve Tried:
- Enabling/disabling Volt’s autoescape mode
- Using Tag::setAutoescape(false); in the Volt view
Has anyone encountered this issue before? Any suggestions on how to properly display the label with unescaped HTML?
Thanks in advance!