I can’t seem to find out how to link a thumbnail image in GridView to a view page.
On my model, I have the following method:
public function getThumbnailUrl()
{
return Url::to($this->marketing_thumb_path, true);
}
And in the view I have:
[
'label' => 'Thumb',
'format' => 'image',
'value' => function ($model) {
return $model->getThumbnailUrl();
},
],
And this works perfectly for displaying the thumbnail image, but I can’t figure out how to make that a clickable link to the view page. ‘format’ => ‘image’ wraps the value in an image tag, so if I do anything inside the closure, like using Html::a, the image tags end up in the wrong place.
There is probably an obvious and simple solution to this, but I’m just missing it. Can anyone help? I would appreciate it, thanks.