I am trying to get this stackoverflow code (URL in yii2 gridview) actually tied to displaying Last_Name from my Contact record and actually generating a mailto: link when the Last_Name is clicked.
My code displays static text and a static link but I don't know how to properly reference the active record.
I also don't want to do a "find" and essentially do a subquery ... it seems that would be very wasteful.
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
// ['class' => 'yii\grid\SerialColumn'],
//'contact_id',
'contact_frequency',
[
'label' => 'Last Name',
'format' => 'raw',
'value' => function ($data) {
return Html::a(Html::encode('replace with $contact->last_name'),'replace with $contact->email1:email');
},
],
'first_name',
// 'title',
'email1:email',
'last_touch_date',
'last_contact',
['class' => 'yii\grid\ActionColumn', 'template' => '{view}'],
],
]); ?>