PHP code example of slavkovrn / yii2-lightbox

1. Go to this page and download the library: Download slavkovrn/yii2-lightbox library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

slavkovrn / yii2-lightbox example snippets


use kartik\grid\GridView;
use slavkovrn\lightbox\LightBoxWidget;

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 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,
                ]);
            }
        ],
    ],
]);