本文整理汇总了PHP中common\models\Category::getGridButtonsTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::getGridButtonsTemplate方法的具体用法?PHP Category::getGridButtonsTemplate怎么用?PHP Category::getGridButtonsTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common\models\Category
的用法示例。
在下文中一共展示了Category::getGridButtonsTemplate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
$this->title = Yii::t('app', 'Categories');
$this->params['breadcrumbs'][] = $this->title;
?>
<section class="content">
<?php
echo \common\widgets\Alert::widget();
?>
<div class="box box-primary">
<div class="box-body">
<h1><?php
echo Html::encode($this->title);
?>
</h1>
<p>
<?php
echo Html::a(Yii::t('app', 'Create Category'), ['create'], ['class' => 'btn btn-success']);
?>
</p>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'emptyText' => 'You don\'t have any categories', 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'title', 'filter' => AutoComplete::widget(['model' => $searchModel, 'attribute' => 'title', 'options' => ['class' => 'form-control'], 'clientOptions' => ['source' => Category::getAutoCompleteItems('title')]])], ['class' => '\\pheme\\grid\\ToggleColumn', 'attribute' => 'active', 'enableAjax' => false, 'filter' => [1 => Yii::t('yii', 'Yes'), 0 => Yii::t('yii', 'No')]], ['class' => 'yii\\grid\\ActionColumn', 'template' => Category::getGridButtonsTemplate(), 'buttons' => ['delete' => function ($url, $model, $key) {
$options = ['title' => Yii::t('yii', 'Delete'), 'aria-label' => Yii::t('yii', 'Delete'), 'data-confirm' => !$model->isUse() ? 'Are you sure you want to delete this item?' : 'Warning! This category is used in other places! Category will be soft deleted!', 'data-method' => 'post', 'data-pjax' => '0'];
return Html::a('<span class="glyphicon glyphicon-trash"></span>', !$model->isUse() ? Url::toRoute(['category/delete', 'id' => $model->id]) : Url::toRoute(['category/soft-delete', 'id' => $model->id]), $options);
}]]]]);
?>
</div>
</div>
</section>