<?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 = 'Affliations Right Columns';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="affliations-right-column-index">

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

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

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

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

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

</div>
