Blame view

backend/modules/location/views/country/list.php 1.2 KB
d1f8bd40   Alexey Boroda   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  <?php
  use backend\widgets\GridView\GridView;
  //
  use yii\helpers\Html;
  use thread\widgets\grid\{
      ActionCheckboxColumn
  };
  
  /**
   * @var $model \backend\modules\location\models\Country
   * @var $filter \backend\modules\location\models\search\Country
   */
  echo GridView::widget([
      'dataProvider' => $model->search(Yii::$app->request->queryParams),
      'filterModel' => $filter,
      'columns' => [
          [
              'class' => \thread\widgets\grid\kartik\EditableColumn::class,
              'attribute' => 'title',
              'displayValue' => function ($model) {
                  return $model->getTitle();
              }
          ],
          [
              'format' => 'raw',
              'value' => function ($model) {
                  return Html::a(
                      Yii::t('location', 'City') . ': ' . ' (' . $model->getCitiesCount() . ')',
                      ['/location/city/list', 'country_id' => $model['id']]
                  );
              }
          ],
          [
              'class' => ActionCheckboxColumn::class,
              'attribute' => 'published',
              'action' => 'published'
          ],
          [
              'class' => \backend\widgets\GridView\gridColumns\ActionColumn::class
          ],
      ]
  ]);