本文整理汇总了PHP中common\models\Product::getGridButtonsTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::getGridButtonsTemplate方法的具体用法?PHP Product::getGridButtonsTemplate怎么用?PHP Product::getGridButtonsTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common\models\Product
的用法示例。
在下文中一共展示了Product::getGridButtonsTemplate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
<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
if (\Yii::$app->user->can('create-product')) {
?>
<?php
echo Html::a(Yii::t('app', 'Create Product'), ['create'], ['class' => 'btn btn-success']);
?>
<?php
}
?>
</p>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'emptyText' => 'You don\'t have any products', 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'title', 'filter' => AutoComplete::widget(['model' => $searchModel, 'attribute' => 'title', 'options' => ['class' => 'form-control'], 'clientOptions' => ['source' => Product::getAutoCompleteItems('title')]])], ['attribute' => 'ui', 'filter' => AutoComplete::widget(['model' => $searchModel, 'attribute' => 'ui', 'options' => ['class' => 'form-control'], 'clientOptions' => ['source' => Product::getAutoCompleteItems('ui')]])], ['class' => '\\pheme\\grid\\ToggleColumn', 'attribute' => 'active', 'enableAjax' => false, 'filter' => [1 => Yii::t('yii', 'Yes'), 0 => Yii::t('yii', 'No')]], ['class' => 'yii\\grid\\ActionColumn', 'template' => Product::getGridButtonsTemplate(), 'buttons' => ['delete' => function ($url, $model, $key) {
$options = ['title' => Yii::t('yii', 'Delete'), 'aria-label' => Yii::t('yii', 'Delete'), 'data-confirm' => '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);
}]]]]);
?>
</div>
</div>
</section>