I have a gridView and i managed to get it to contain the data i need, but what i need to do next is to create a column which contains two buttons for has_facebook and has_twitte
Just a tip: If you are rendering complex data, this was would be helpful in Yii2..
echo yii\grid\GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'id',
[
'attribute' => 'Details',
'format' => 'raw',
'value' => function ($model) {
return $this->render('//path/to/view.php', ['model' => $model]);
},
]
]
]);
or you can use
echo \yii\widgets\ListView::widget([
'dataProvider' => $dataProvider,
'itemView' => '//path/to/view.php',
]);
and the partial view could be something like
= Html::img('@web/user/images' . $model->id . '.jpeg', ['alt' => 'Profile Picture', 'class' => 'img img-rounded']); ?>
= Html::encode($model->firstName) ?> = Html::encode($model->lastName) ?>,
living in = Html::encode($model->city) ?> = Html::encode($model->country) ?>