eluhr/yii2-baguette-box

There is no license information available for the latest version (1.0.0) of this package.

Yii2 Wrapper for feimosi/baguetteBox.js

1.0.0 2022-01-20 12:16 UTC

This package is auto-updated.

Last update: 2024-11-20 18:21:10 UTC


README

Yii2 Wrapper for feimosi/baguetteBox.js

Install

composer require eluhr/yii2-baguette-box

Usage

PHP

<?php
use eluhr\baguettebox\widgets\BaguetteBox;

echo BaguetteBox::widget([
    'items' => [
        [
            '/path/to/image-0.jpg',
            'link-options' => [
                'data-caption' => 'My caption 0'
            ]
        ],
        [
            '/path/to/image-1.jpg',
            'link-options' => [
                'data-caption' => 'My caption 1'
            ]
        ],
        '/path/to/image-2.jpg',
        [
            '/path/to/image-3.jpg',
            'link-options' => [
                'data-caption' => 'My caption 2'
            ],
            'image-options' => [
                'class' => 'my-class'
            ]
        ],
        '/path/to/image-4.jpg',
        [
            '/path/to/image-6.jpg',
            'thumbnail' => '/path/to/image-6-thumbnail.jpg'
        ]
    ],
    'items_per_row' => 4,
    'plugin_options' => [
        'noScrollbars' => true
    ],
    'options' => [
        'class' => 'gallery',
    ],
    'responsive' => [
        991 => 2,
        768 => 1    
    ]
]);
?>

TWIG

{{ use ('eluhr/baguettebox/widgets/BaguetteBox') }}

{{ BaguetteBox_widget({
    'items' : {
        {
            '/path/to/image-0.jpg',
            'link-options' : {
                'data-caption' : 'My caption 0'
            }
        },
        {
            '/path/to/image-1.jpg',
            'link-options' : {
                'data-caption' : 'My caption 1'
            }
        },
        {
            '/path/to/image-3.jpg',
            'link-options' : {
                'data-caption' : 'My caption 2'
            }
        },
        {
            '/path/to/image-6.jpg',
            'thumbnail' : '/path/to/image-6-thumbnail.jpg'
        }
    },
    'items_per_row' : 4,
    'plugin_options' : {
        'noScrollbars' : true
    },
    'options' : {
        'class' : 'gallery',
    },
    'responsive' : {
        991 : 2,
        768 : 1
    }
}) }}