HTML in Yii2 GridView
<p>I'm trying to display some HTML encoded strings as pure HTML in a column positioned in Yii2 GridView. The string that comes from the database looks like this:</p>

<pre><code>Testing &amp;lt;span class=&amp;#039;test&amp;#039;&amp;gt;HTML&amp;lt;/span&amp;gt;
</code></pre>

<p>If I just display it using HTML decode <code>Html::decode($theStringAbove);</code> then I get this in the column:</p>

<pre><code>Testing &lt;span class='test'&gt;HTML&lt;/span&gt;
</code></pre>

<p>However, what I'm aiming at is simply getting <code>Testing HTML</code> and having the <code>span</code> tag around the HTML word in the code but not displayed as a string.</p>

<p>I've tried setting different values to the <code>format</code> attribute such as <code>raw</code>, <code>url</code> and <code>html</code> to no success. I also have no problem writing a custom function to return the correct output next to the <code>value</code> attribute, it's just that I can't figure out how to get to the output I need. Any suggestions are welcome, thank you!</p>

<p>EDIT: Here's a small code snippet if that's helpful:</p>

<pre><code>[ 'format' =&gt; 'raw',
  'value' =&gt; function($model) { return Html::decode($model-&gt;text); },
  'label' =&gt; Yii::t('app', 'Some Label')]
</code></pre>