I want to hide labels for the detail view
<?= DetailView::widget([
'model' => $model,
//To hide labels
'label' => ['hidden' => true],
'attributes' => [
'visits'
],
]) ?>
On the above snipet of code, there is 'label' => ['hidden' => true], is there but it is not a method which is existing. I want to know is there a method to hide labels Something which is equivalent to that.
If you want to hide label column in GridView you must modify its enter link description heretemplate. For example:
<?= DetailView::widget([
'model' => $model,
'template' => '<tr><td{contentOptions}>{value}</td></tr>',
'attributes' => [
// your attributes for displaying
],
]) ?>
If you want to hide a label in one cell you can set an empty string to label
property:
<?= DetailView::widget([
'model' => $model,
'template' => '<tr><td{contentOptions}>{value}</td></tr>',
'attributes' => [
[
'attribute' => 'id',
'label' => ''
]
// your attributes for displaying
],
]) ?>