I am trying to pass $arr_judete_v2 as a parameter to a callback function in gridview and does not work;
$model['county_id'] returns a number
$arr_judete_v2[1]['nume'] returns the name
my problem:
[ 'attribute' => 'county_id', 'label' => Yii::t('diverse', 'Judet'), 'content' => function($model, $arr_judete_v2) { return $arr_judete_v2[$model['county_id']]['nume']; }, ],
whole gridview
<?php echo GridView::widget([ 'layout' => "{items}", 'dataProvider' => $dataProvider, 'columns' => [ 'id', [ 'attribute' => 'nume', 'label' => Yii::t('companie', 'nume'), ], 'cui', 'email', [ 'attribute' => 'county_id', 'label' => Yii::t('diverse', 'Judet'), 'content' => function($model, $arr_judete_v2) { return $arr_judete_v2[$model['county_id']]['nume']; }, ], [ 'class' => 'yii\grid\ActionColumn', 'template' => '{update} {delete}', 'buttons' => [ 'update' => function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-pencil"></span>', ['update', 'id' => $model['id']], [ 'title' => Yii::t('yii', 'Update'), 'data-pjax' => '0', ]); } ] ], ], ]);