Yii2 の Bootsrap Tabs ウィジェット (yii\bootstrap\Tabs -- http://www.yiiframework.com/doc-2.0/yii-bootstrap-tabs.html )を使用しています。
label
このウィジェットを構築する配列のキーの値として HTML タグを挿入したいと考えています。
'encode' => true
オプションの配列要素の 1 つとしてkey => value ペアを含めようとしましたが、何もしませんでした。
これが私のコードです:
<?=
Tabs::widget([
'navType' => 'nav-pills',
'options' => ['class' => 'course-manager'],
'items' => [
[
'label' => '<i class="fa fa-book"></i> Show Books',
'encode' => true,
'content' => '<h2>Anim pariatur cliche...</h2>',
'active' => true
],
[
'label' => '<i class="fa fa-graduation-cap"></i><span> Show Students</span>',
'encode' => true,
'content' => 'Anim cliche...',
],
[
'label' => '<i class="fa fa-tags"></i><span> Show Licenses</span>',
'encode' => true,
'url' => 'http://www.example.com',
],
],
]);
?>
これらのラベルは、HTML ではなくテキストとして表示されています。