當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ActionColumn::initDefaultButtons方法代碼示例

本文整理匯總了PHP中yii\grid\ActionColumn::initDefaultButtons方法的典型用法代碼示例。如果您正苦於以下問題:PHP ActionColumn::initDefaultButtons方法的具體用法?PHP ActionColumn::initDefaultButtons怎麽用?PHP ActionColumn::initDefaultButtons使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在yii\grid\ActionColumn的用法示例。


在下文中一共展示了ActionColumn::initDefaultButtons方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: initDefaultButtons

 /**
  * Initializes the default button rendering callbacks.
  */
 protected function initDefaultButtons()
 {
     parent::initDefaultButtons();
     if (!isset($this->buttons['active'])) {
         $this->buttons['active'] = function ($url, $model) {
             return Html::a('<span onclick="admin_api.request({id:' . $model['id'] . ', model:\'' . lcfirst((new \ReflectionClass($model))->getShortName()) . '\', method:\'post\', attributes:{active:' . ($model['active'] ? '0' : '1') . '}})" class="glyphicon ' . ($model['active'] ? 'glyphicon-ok' : 'glyphicon-ban-circle') . ' " style="color: ' . ($model['active'] ? 'yellow' : 'gray') . ' "></span>', '', ['title' => $model['active'] ? 'Отключить' : 'Включить']);
         };
     }
 }
開發者ID:hysdop,項目名稱:YobaCMS,代碼行數:12,代碼來源:ActionColumnCustom.php

示例2: initDefaultButtons

 protected function initDefaultButtons()
 {
     parent::initDefaultButtons();
     if (!isset($this->buttons['form-view'])) {
         $this->buttons['form-view'] = function ($url, $model, $key) {
             $options = array_merge(['title' => Yii::t('yii', 'Add'), 'aria-label' => Yii::t('yii', 'Add'), 'data-pjax' => '0'], $this->buttonOptions);
             return Html::a('<span class="glyphicon glyphicon-wrench"></span>', $url, $options);
         };
     }
 }
開發者ID:amarshimi,項目名稱:Yii2-Forms-Builder,代碼行數:10,代碼來源:DynamicFormsButtons.php

示例3: initDefaultButtons

 protected function initDefaultButtons()
 {
     parent::initDefaultButtons();
     if (!isset($this->actionName)) {
         $this->actionName = 'disable';
     }
     if (!isset($this->buttons[$this->actionName])) {
         $this->buttons[$this->actionName] = function ($url, $model, $key) {
             $label = $model->{$this->stateAttribute} ? Yii::t('app', 'Enable') : Yii::t('app', 'Disable');
             $options = array_merge($this->buttonOptions, ['title' => $label, 'aria-label' => $label, 'data-method' => 'post', 'data-pjax' => '0', 'class' => 'btn btn-block ' . ($model->{$this->stateAttribute} ? 'btn-success' : 'btn-danger')]);
             if (isset($this->confirmation)) {
                 $options['data-confirm'] = $this->confirmation;
             }
             return Html::a('<span class="glyphicon glyphicon-ban-circle"></span> ' . $label, $url, $options);
         };
     }
 }
開發者ID:just-leo,項目名稱:cardgame-serial,代碼行數:17,代碼來源:DisableActionColumn.php

示例4: initDefaultButtons

 /**
  * Initializes the default button rendering callbacks.
  */
 protected function initDefaultButtons()
 {
     ActionAsset::register($this->grid->view);
     parent::initDefaultButtons();
     if (!isset($this->buttons['up'])) {
         $this->buttons['up'] = function ($url) {
             $options = ArrayHelper::merge(['title' => Yii::t('hass', 'Up'), 'aria-label' => Yii::t('hass', 'Up'), 'data-pjax' => '0'], $this->buttonOptions);
             Html::addCssClass($options, "move-up");
             return Html::a('<span class="glyphicon glyphicon-arrow-up"></span>', $url, $options);
         };
     }
     if (!isset($this->buttons['down'])) {
         $this->buttons['down'] = function ($url) {
             $options = ArrayHelper::merge(['title' => Yii::t('hass', 'Down'), 'aria-label' => Yii::t('hass', 'Down'), 'data-pjax' => '0'], $this->buttonOptions);
             Html::addCssClass($options, "move-down");
             return Html::a('<span class="glyphicon glyphicon-arrow-down"></span>', $url, $options);
         };
     }
 }
開發者ID:rocketyang,項目名稱:hasscms-app,代碼行數:22,代碼來源:ActionColumn.php


注:本文中的yii\grid\ActionColumn::initDefaultButtons方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。