G
G
Greg Popov2016-05-12 19:21:05
Yii
Greg Popov, 2016-05-12 19:21:05

How to display value as rendered HTML in Yii2 DetailView?

Actually here is the code:

<?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'id',
            [
                'attribute' => 'parent_id',
                'value' => ($model->parent ?
                    Yii::t('app', 'This is parent category is: ').$model->parent->title :
                    Yii::t('app', 'This is parent category')
                ),

            ],
            'title',
            'url_tag:url',
            'icon_code',
            'mkeywords',
            'mdescription:ntext',
        ],
    ]) ?>

icon_code is the Fontawesome icon code, it needs to be substituted and rendered as html, whatever one may say, it displays text.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita, 2016-05-12
@Gregpopov

icon_code:raw

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question