<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\grid\Column;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\LanguageSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('app', 'Languages');
$this->params['breadcrumbs'][] = $this->title;
echo $this->render('layout');
?>
<div class="lang-column-2">

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'layout' => "{items}",
        'columns' => [
            [
                'class' => Column::className(),
                'content' => function($model, $key, $index, $column) {
                    return '<span class="f32"><span class="flag '.$model->country_code.'"></span></span>';
                }
            ],
            'language_name',
            'language_code',
            'is_default:boolean',
            [
                'class' => 'yii\grid\ActionColumn',
                'template' => '{default} {delete}',
                'buttons' => [
                    'default' => function ($url, $model, $key) {
                        return Html::a('', $model->is_default?'#':$url, ['class' => $model->is_default?'glyphicon glyphicon-star':'glyphicon glyphicon-star-empty', 'title' => Yii::t('app', 'Make default')]);
                    },
                ],
            ]
        ]
    ]); ?>
    
    <p class="text-right">
        <?= Html::a(Yii::t('app', 'Create Language'), ['create'], ['class' => 'btn btn-success']) ?>
    </p>

</div>
