slavkovrn/yii2-fancybox

Yii2 FancyBox image galary widget uses fancyBox v2.1.5 by Janis Skarnelis

Installs: 85

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 0

Open Issues: 0

Language:CSS

Type:yii2-extension

dev-master 2020-03-20 11:22 UTC

This package is auto-updated.

Last update: 2024-03-20 19:40:50 UTC


README

The extension uses jQuery fancyBox v2.1.5 by Janis Skarnelis and makes image galary from php array of structure defined.

FancyBox image galary PHP Array generator.

FancyBox image galary

Installation

The preferred way to install this extension is through composer.

Either run:

composer require slavkovrn/yii2-fancybox

or add

"slavkovrn/yii2-fancybox": "*"

to the require section of your composer.json file.

Usage

Set link to extension in your view:

use kartik\grid\GridView;
use slavkovrn\fancybox\FancyBoxWidget;

echo GridView::widget([
    'dataProvider' => $dataProvider,
    'columns' => [
        [
            'header' => 'Pictures',
            'content' => function ($data){
                $images = [               // images at popup window of prettyPhoto galary
                    1 => [
                            'src' => 'http://yii2.kadastrcard.ru/uploads/prettyphoto/image1.jpg',
                            'title' => 'Image visible in widget',
                        ],
                    2 => [
                            'src' => 'http://yii2.kadastrcard.ru/uploads/prettyphoto/image2.jpg',
                            'title' => 'image 1',
                        ],
                    3 => [
                            'src' => 'http://yii2.kadastrcard.ru/uploads/prettyphoto/image3.jpg',
                            'title' => 'image 2',
                        ],
                    4 => [
                            'src' => 'http://yii2.kadastrcard.ru/uploads/prettyphoto/image4.jpg',
                            'title' => 'image 3',
                        ],
                ];
                return FancyBoxWidget::widget([
                    'id'     =>'fancybox',  // id of plugin should be unique at page
                    'class'  =>'fancybox',    // class of plugin to define style
                    'height' =>'100px',     // height of image visible in widget
                    'width' =>'100px',      // width of image visible in widget
                    'images' => $images,
                ]);
            }
        ],
    ],
]);

write comments to admin