Sarvar Nishonboyev Sarvar Nishonboyev - 3 months ago 42x
PHP Question

URL in yii2 gridview

In yii2 gridview, I have this code:

<?php echo GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'format' => 'url',
'value'=>function ($data) {
return Html::url('site/index');
['class' => 'yii\grid\ActionColumn'],
]); ?>

In grid view, text is being generated with url address.


Url is working fine, but how can I set a text for link?


Use 'format' => 'raw' instead of 'format' => 'url'.