Unknown Property – yii\base\UnknownPropertyException ::discription:html

孤人 提交于 2019-12-23 04:29:37

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!