public function api_plugin($options = []) { Fancybox::widget(['selector' => '.easyii-box', 'options' => $options]); }
<?php use yii\easyii\widgets\Fancybox; use yii\helpers\Html; use yii\helpers\Url; use yii\easyii\assets\PhotosAsset; PhotosAsset::register($this); Fancybox::widget(['selector' => '.plugin-box']); $model = get_class($this->context->model); $item_id = $this->context->model->primaryKey; $linkParams = ['model' => $model, 'item_id' => $item_id, 'maxWidth' => $this->context->maxWidth, 'thumbWidth' => $this->context->thumbWidth, 'thumbHeight' => $this->context->thumbHeight, 'thumbCrop' => $this->context->thumbCrop]; $photoTemplate = '<tr data-id="{{photo_id}}">' . (IS_ROOT ? '<td>{{photo_id}}</td>' : '') . '\\ <td><a href="{{photo_image}}" class="plugin-box" title="{{photo_description}}" rel="easyii-photos"><img class="photo-thumb" id="photo-{{photo_id}}" src="{{photo_thumb}}"></a></td>\\ <td>\\ <textarea class="form-control photo-description">{{photo_description}}</textarea>\\ <a href="' . Url::to(['/admin/photos/description/{{photo_id}}']) . '" class="btn btn-sm btn-primary disabled save-photo-description">' . Yii::t('easyii', 'Save') . '</a>\\ </td>\\ <td class="control vtop">\\ <div class="btn-group btn-group-sm" role="group">\\ <a href="' . Url::to(['/admin/photos/up/{{photo_id}}'] + $linkParams) . '" class="btn btn-default move-up" title="' . Yii::t('easyii', 'Move up') . '"><span class="glyphicon glyphicon-arrow-up"></span></a>\\ <a href="' . Url::to(['/admin/photos/down/{{photo_id}}'] + $linkParams) . '" class="btn btn-default move-down" title="' . Yii::t('easyii', 'Move down') . '"><span class="glyphicon glyphicon-arrow-down"></span></a>\\ <a href="' . Url::to(['/admin/photos/image/{{photo_id}}'] + $linkParams) . '" class="btn btn-default change-image-button" title="' . Yii::t('easyii', 'Change image') . '"><span class="glyphicon glyphicon-floppy-disk"></span></a>\\ <a href="' . Url::to(['/admin/photos/delete/{{photo_id}}']) . '" class="btn btn-default color-red delete-photo" title="' . Yii::t('easyii', 'Delete item') . '"><span class="glyphicon glyphicon-remove"></span></a>\\ <input type="file" name="Photo[image]" class="change-image-input hidden">\\ </div>\\ </td>\\ </tr>'; $this->registerJs("\nvar photoTemplate = '{$photoTemplate}';\n", \yii\web\View::POS_HEAD); $photoTemplate = str_replace('>\\', '>', $photoTemplate); ?> <button id="photo-upload" class="btn btn-success text-uppercase"><span class="glyphicon glyphicon-arrow-up"></span> <?php