i change default link in ActionColumn of grid,
Estoy modificando el link por defecto en un grid el ActionColumn, pero el mismo includes a variable that sent from the controller and not part of the $ model or $ data grid
Controller send variable to view:
…
return $this->render(‘view’,array(’$hardware’=>$hardware, ‘providerRevList’=>$providerRevList));
…
View:
…
[‘class’ => ‘yii\grid\ActionColumn’,
‘template’=>’{view}’,
‘buttons’ => [
‘view’ => function ($url, $model) {
return Html::a(’<span class=“glyphicon glyphicon-eye-open”></span>’,
[‘commit’, ‘id’ => $hardware->id, ‘hash’ => ‘$data[“h”]’],
[‘title’ => Yii::t(‘app’, ‘Detail’)]);
},
],
],
…
$hardware->id = this is error on view
$data["h"] = is a model of dataprovider
Error
…
PHP Notice – yii\base\ErrorException
Undefined variable: hardware
- in …/views/default/view.php at line 60
[‘class’ => ‘yii\grid\ActionColumn’,
‘template’=>’{view}’,
‘buttons’ => [
‘view’ => function ($url, $model) {
return Html::a(’<span class=“glyphicon glyphicon-eye-open”></span>’,
[‘commit’, ‘id’ => $hardware->id, ‘hash’ => ‘$data[“h”]’],
[‘title’ => Yii::t(‘app’, ‘Detail’)]);
},
],
…
I used the variable $hardware->id as title on view, but when trying to include it in the link throws error.