<?php

use slavkovrn\lightbox\LightBoxWidget;
use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model common\models\Cat */

$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => '分类', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="cat-view">
    <?= $this->render('../site/view_menu', [ 'model' => $model]) ?><div class="box box-success">
        <div class="box-body">
    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'id',
            'title',
            'ptitle',
            [
                'attribute' => 'cover',
                'format' => 'raw',
                'value' => function ($model){
                    $images = [               // images at popup window of prettyPhoto galary
                        1 => [
                            'src' => $model->cover,
                            'title' => '',
                        ],
                    ];
                    return $model->cover ?  LightBoxWidget::widget([
                        'id'     =>'lightbox',  // id of plugin should be unique at page
                        'class'  =>'galary',    // class of plugin to define style
                        'height' =>'100px',     // height of image visible in widget
                        'width' =>'100px',      // width of image visible in widget
                        'images' => $images,
                    ]) : null;
                }
            ],
            'created_at:datetime',
            'updated_at:datetime',
            'slug',
            'sort'
        ],
    ]) ?>
        </div>
    </div>

</div>
