当前位置: 首页>>代码示例>>PHP>>正文


PHP Category::getGridButtonsTemplate方法代码示例

本文整理汇总了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>
开发者ID:ninetor,项目名称:yii-classifield,代码行数:30,代码来源:index.php


注:本文中的common\models\Category::getGridButtonsTemplate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。