问题
This is the continuation of this question How to hide detail view labels on yii2
<?= DetailView::widget([
'model' => $model,
'template' => '<tr><td{contentOptions}>{value}</td></tr>',
'attributes' => [
[
'attribute' => 'discription:html',
'label' => ''
]
],
]) ?>
The description is supposed to render in HTML only So the above code is but if I use the above code I am ending up in at this error. Unknown Property – yii\base\UnknownPropertyException
回答1:
Each attribute may has own settings which might be configured in attribute array. For example, you can configure the data format like:
<?= DetailView::widget([
'model' => $model,
'attributes' => [
[
'attribute' => 'discription',
'format' => 'html'
'label' => ''
]
],
]) ?>
来源:https://stackoverflow.com/questions/53960666/unknown-property-yii-base-unknownpropertyexception-discriptionhtml