there is such a code
if(is_array($color)){$colorDatas=ArrayHelper::map($color,'id','value');} now I need if $ colorDatas is not empty I need to add the following widget to the 'columns'
[ 'filter' =>Select2::widget ([ 'model' => $searchModel, 'attribute' => 'color', 'data' => $colorDatas, 'language' => 'ru', 'options' => ['multiple' => true,'placeholder' => Yii::t('backend','SELECT_SHOP')], 'pluginOptions' => [ 'allowClear' => true ], ]), 'attribute' => 'color', 'value' => function($model){ return $model->theGetValue($model); } ], in GridView do not tell me how to do it