= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
[
'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' => 'cover', // 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;
}
],
[
'attribute' => 'banner',
'format' => 'raw',
'value' => function ($model) {
$images = [];
foreach ($model->banner as $index => $banner) {
$images[$index] = ['src' => $banner, 'title' => ''];
}
return $model->banner ? LightBoxWidget::widget([
'id' => 'banner', // 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;
}
],
[
'attribute' => 'picture',
'format' => 'raw',
'value' => function ($model) {
$images = [];
foreach ($model->picture as $index => $picture) {
$images[$index] = ['src' => $picture, 'title' => ''];
}
return $model->picture ? LightBoxWidget::widget([
'id' => 'picture', // 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;
}
],
[
'attribute' => 'vid',
'format' => 'raw',
'value' => function ($model){
return '';
}
],
'name',
'desc',
[
'attribute' => 'province',
'format' => 'raw',
'value' => function ($model) {
return \common\models\Region::getNameById($model->province);
},
],
[
'attribute' => 'city',
'format' => 'raw',
'value' => function ($model) {
return \common\models\Region::getNameById($model->city);
},
],
[
'attribute' => 'area',
'format' => 'raw',
'value' => function ($model) {
return \common\models\Region::getNameById($model->area);
},
],
'address',
'fields',
'works',
'tel',
'created_at:datetime',
'updated_at:datetime',
[
'attribute' => 'status',
'value' => function ($model) {
return Master::getStatusList($model->status);
},
],
],
]) ?>
= GridView::widget([
'dataProvider' => $index['data'],
//'filterModel' => $searchModel,
'columns' => [
'id',
'goods_id',
'entity',
'entity_id',
'attribute',
[
'class' => 'common\helpers\DiyActionColumn',
'template' => '{update} {delete}',
'buttons' => [
'update' => function ($url, $model, $key) {
return Html::a(Yii::t('yii', 'Update'), Url::to(['/goods-index/update', 'id' => $model->id,'origin'=>Yii::$app->request->url]), [
'class' => 'btn btn-success btn-xs',
'title' => Yii::t('common', 'Update Goods Index'),
'target' => '_blank'
]);
},
'delete' => function ($url, $model, $key) {
return Html::a('删除', Url::to(['/goods-index/delete', 'id' => $model->id,'origin'=>Yii::$app->request->url]), [
'class' => 'btn btn-success btn-xs',
'title' => Yii::t('common', '删除关联商品'),
'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'),
'data-method' => 'post',
]);
},
],
],
],
]); ?>