<?php

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

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Home Sliders';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="home-slider-index">

    <h1><?= Html::encode($this->title) ?></h1>

    <p>
        <?= Html::a('Create Home Slider', ['create'], ['class' => 'btn btn-success']) ?>
    </p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'id',
            [
               'attribute' => 'images',
               'label' => 'Image.',
               'value' => function ($model) {
                   if(!empty($model->images))
                       return Html::img(Yii::$app->params['front_url'].'images/homeslider/'.$model->images,["style"=>"width:100px;height:auto;"]);
                   return null;
               },
               'format' => "html",
           ],
            'smallText',
            'bigText',
            //'links',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>

</div>
