, actioncoloumn, . http://www.yiiframework.com/doc-2.0/yii-grid-actioncolumn.html# $buttons-detail
. - :
'buttons' => [
'update' => function ($url, $model, $key) {
if ($model->id == Yii::$app->user->identity->id) {
$options = [
'title' => Yii::t('yii', 'Update'),
'aria-label' => Yii::t('yii', 'Update'),
'data-pjax' => '0',
];
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, $options);
}
},
'delete' => function ($url, $model, $key) {
if ($model->id == 6929) {
$options = [
'title' => Yii::t('yii', 'Delete'),
'aria-label' => Yii::t('yii', 'Delete'),
'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'),
'data-method' => 'post',
'data-pjax' => '0',
];
return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, $options);
}
},
],
ActionColumn, . , , model- > user- > identity- > id
protected function renderDataCellContent($model, $key, $index)
{
if ($model->id == Yii::$app->user->identity->id) {
return parent::renderDataCellContent($model, $key, $index);
}
}
, .
Actioncolumn. , , , urlCreator pjax ..
, , , soju .