2017 © Pedro Peláez
 

luya-extension luya-ext-slick

Responsive and adaptive Yii2 image slider for LUYA as Block, Widget and Module based and Slick.js

image

dev7ch/luya-ext-slick

Responsive and adaptive Yii2 image slider for LUYA as Block, Widget and Module based and Slick.js

  • Thursday, June 28, 2018
  • by dev7ch
  • Repository
  • 2 Watchers
  • 3 Stars
  • 66 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 2 Open issues
  • 7 Versions
  • 16 % Grown

The README.md

Adaptive and responsive slider extension for LUYA

Latest Stable Version Build Status Coverage Status Code Quality Total Downloads License, (*1)

Implements the responsive SlickSlider from Ken Wheeler as a LUYA widget which can be used out of the box in the LUYA admin UI as draggable block extension in your project., (*2)

See the slider demo page., (*3)

This is an yii2 extension for LUYA., (*4)

Features

  • Adaptive images based on screen min-width and/or orientation
  • Optionally addition of retina images separately
  • Reusable widget which can be included in own custom view files
  • Picturefill included for better browser support of <picture> tag
  • Schema.org standards for images gallery are in charge
  • Multilingual LUYA admin UI support
  • Responsive and touch friendly

Installation

  1. Add the composer package to your project:
composer require dev7ch/luya-ext-slick
  1. Run import
./luya import

Usage

This LUYA extension is usable in two ways:, (*5)

  • As draggable block out of the box in the LUYA admin UI.
  • As PHP widget in custom view files with custom Slick.js settings.

1. Block Usage

Simply drag and drop the block in the pages section in the admin UI to the desired place and add content to your new slick slider., (*6)

2. Widget Usage

This extension is shipped as widget which means it can the reused in own custom views from modules or blocks., (*7)

Example usage in a block view file:, (*8)

extraValue('images'); // Array of images width additional fields

?>



= SlickWidget::widget([ 'images' => $images, 'slickConfigWidget' => [ 'infinite' => 'true', 'slidesToShow' => '1', 'slidesToScroll' => '1', 'autoplay' => 'true', 'autoplaySpeed' => '5000' // see all available configs http://kenwheeler.github.io/slick/#settings ] ]) ?>

Or you could load the Slick.js configs from a file like this:, (*9)


= SlickWidget::widget([ 'images' => $images, 'slickConfigFile' => 'path/to/yourConfig.php' // or a .json file ]); ?>

The beginning of the path points to your project root folder (not web root, which is directory public_html)., (*10)

Using slickConfigFile will override slickConfigWidget if it is configured., (*11)

Due this widget supports adaptive images, below a little explanation of the logic behind., (*12)

The single image and additional info are delivered as an array:, (*13)



images as $image): $title = $image['title']; $link = $image['link']; $imageFallback = $image['image']->source; $respImages = $image['responsive_images']; $alt = $image['alt']; ?> // ... slider content array

The array of the single image includes an nested array for adaptive images, in particular:, (*14)

// ... wrapped by foreach loop with vars declaration  



link.'" itemprop="contentUrl">';} ?> source; $imageHD = $item['imageHD'] ? $item['imageHD']->source : $item['image']->source; $orientation = $item['orientation'] ? ' and (orientation:'.$item['orientation'].')' : ''; $breakpoint = $item['breakpoint'] ? ' media="(min-width:'.$item['breakpoint'].'px)'.$orientation.'"' : 'media="(min-width:0)'.$orientation.'"'; ?> > <?= $alt ?> <?= $alt ?> ';} ?>
= $title ?>

Collaboration

StyleCI, (*15)

If you would like to contribute any thing, e.g. translations, you are very welcome., (*16)

For usage of this repo inside your LUYA env dev please keep in mind that picturefill and slick-carousel are needed dependencies inside your vendor/bower folder, simply add them to your composer.json inside the luya-env-dev root directory by running:, (*17)

composer require bower-asset/slick-carousel:~1.8.0
composer require bower-asset/picturefill:~3.0.0

Unit Tests

1.) Create assets directory.
2.) Run ./vendor/bin/phpunit tests/SlickBlockTest.php, (*18)

Make sure composer installed all needed dependencies correctly inside your corresponding vendor folder, (*19)

To run the PHPUnit Test the directory assets/ needs to be created in the root folder of this extension, e.g. luya-env-dev/repos/luya-ext-slick/assets., (*20)

The assets/ directory is in charge for test execution only and should not be tracked or commited by your VCS., (*21)

On the horizon

  • adding all slick js options to admin UI block cfgs
  • adding all slick js options as properties to the widget
  • create admin UI block view

The Versions

28/06 2018

dev-master

9999999-dev https://luya.io

Responsive and adaptive Yii2 image slider for LUYA as Block, Widget and Module based and Slick.js

  Sources   Download

MIT

The Requires

 

The Development Requires

extension php yii2 responsive slider slick adaptive luya

10/05 2018

v1.1.3

1.1.3.0 https://luya.io

Responsive and adaptive Yii2 image slider for LUYA as Block, Widget and Module based and Slick.js

  Sources   Download

MIT

The Requires

 

The Development Requires

extension php yii2 responsive slider slick adaptive luya

12/03 2018

v1.1.2

1.1.2.0 https://luya.io

Responsive and adaptive Yii2 image slider for LUYA as Block, Widget and Module based and Slick.js

  Sources   Download

MIT

The Requires

 

The Development Requires

extension php yii2 responsive slider slick adaptive luya

01/01 2018

v1.1.1

1.1.1.0 https://luya.io

Responsive and adaptive Yii2 image slider for LUYA as Block, Widget and Module based and Slick.js

  Sources   Download

MIT

The Requires

 

The Development Requires

extension php yii2 responsive slider slick adaptive luya

30/12 2017

dev-experimental

dev-experimental https://luya.io

Responsive and adaptive Yii2 image slider for LUYA as Block, Widget and Module based and Slick.js

  Sources   Download

MIT

The Requires

 

The Development Requires

extension php yii2 responsive slider slick adaptive luya

29/12 2017

v1.1.0

1.1.0.0 https://luya.io

Responsive and adaptive Yii2 image slider for LUYA as Block, Widget and Module based and Slick.js

  Sources   Download

MIT

The Requires

 

The Development Requires

extension php yii2 responsive slider slick adaptive luya

29/12 2017

v1.0.0

1.0.0.0 https://luya.io

Responsive and adaptive Yii2 image slider for LUYA as Block, Widget and Module based and Slick.js

  Sources   Download

MIT

The Requires

 

The Development Requires

extension php yii2 responsive slider slick adaptive luya