Render string in 'label' of Yii2 Bootstrap widget as HTML -
i'm using yii2's bootsrap tabs widget (yii\bootstrap\tabs -- http://www.yiiframework.com/doc-2.0/yii-bootstrap-tabs.html)
i want insert html tags value of label
key in array builds widget.
i tried including key => value pair of 'encode' => true
1 of optional array elements did nothing.
here's code:
<?= 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', ], ], ]); ?>
those labels being displayed text instead of html.
if want html code rendered should use 'encodelabels' => false,
tabs::widget([ 'navtype' => 'nav-pills', 'options' => ['class' => 'course-manager'], 'encodelabels' => false, 'items' => [ [ 'label' => '<i class="fa fa-book"></i> show books', 'content' => '<h2>anim pariatur cliche...</h2>', 'active' => true ],
Comments
Post a Comment