In my gridview, I setup a column such as
[
'label' => 'Client Contact',
'format' => 'raw',
'value' => function ($model) {
if ($model->contact === null) {
return '-';
}
return Html::tag(
'span',
$model->contact->FullName,
[
'data-toggle' => 'popover',
'data-placement' => 'top',
'data-content' => $model->contact->ContactInfo,
'data-html' => 'true',
'style' => 'cursor:pointer;text-decoration:underline',
]
);
},
],
Where
$model->contact->ContactInfo
outputs an HTML string that I want used in a popover. My issue is that although I confirmed it properly outputs the HTML string I want, for some reason, when it is used in the ‘Html::tag(…’ it always gets encoded and thus displays all the HTML tags as gibberish.
Is there a way to tell yii2 not to ‘help’ and not encode what is passed to it? I’m hoping I overlooked something in the documentation.
Right now, my fix was to manually write the complete HTML for the entire tag myself and not use the helper.