well I am using Kartik/Detail View and I only want to show the edit and delete button in the panel if the user is Admin. My code is :
<?= DetailView::widget([
'model'=>$model,
'condensed'=>true,
'hover'=>true,
'mode'=>DetailView::MODE_VIEW,
'panel'=>[
'heading'=>'Empleado ' . $model->RPE,
'type'=>DetailView::TYPE_INFO,
],
'buttons1' => '{view}',
Doing this im just only hidding the buttons but for everyone and just showing the view button but i don't want this.
In my GridView i am doing something like this but in the DeatailView didn't work, so i dont know how to implement this there.
['class' => 'kartik\grid\ActionColumn',
'header' => 'Acciones',
'template'=> '{view} {update} {delete} ',
'buttons'=> [
'update'=> function($url,$model) {
if (Yii::$app->user->isGuest ? FALSE : (Yii::$app->user->identity->isAdmin)) {
return(Html::a( '<span class="glyphicon glyphicon-pencil"></span>', $url));
}
},
'delete'=>function($url,$model,$key) {
if (Yii::$app->user->isGuest ? FALSE : (Yii::$app->user->identity->isAdmin)) {
return(Html::a('<span class="glyphicon glyphicon-trash"></span>', $url));
}
},
],