2017 © Pedro Peláez
 

yii2-extension yii2-slider

Module for adding image slider to site across dashboard

image

black-lamp/yii2-slider

Module for adding image slider to site across dashboard

  • Sunday, September 10, 2017
  • by GutsVadim
  • Repository
  • 2 Watchers
  • 1 Stars
  • 154 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 6 % Grown

The README.md

Slider module for Yii2

Module for adding the image slider to site across dashboard and append it to view with widget help. This extension uses Slick slider., (*1)

Build Status Latest Stable Version Latest Unstable Version License, (*2)

Installation

Run command

composer require black-lamp/yii2-slider

or add, (*3)

"black-lamp/yii2-slider": "*"

to the require section of your composer.json., (*4)

Applying migrations

yii migrate --migrationPath=@vendor/black-lamp/yii2-slider/src/common/migrations

Add module to application config

Module for backend, (*5)

'modules' => [
     // ...
     'slider' => [
         'class' => bl\slider\backend\Module::class
     ]
]

Module configuration properties

Option Description Type Default
imagesRoot Path to images catalog in web folder (need for uploading images to the server across dashboard) string @frontend/web/img/slider
urlSeparator Separator for getting url to image from image path string web
imagePrefix Prefix for uploaded images (need for uploading images to the server across dashboard) string slider

Using

You should use the widget for adding the slider to the page

<?= bl\slider\frontend\widgets\SliderWidget::widget([
        'sliderKey' => 'home-page-slider'
    ]) ?>

Widget configuration properties

Option Description Type Default
sliderKey Unique slider key string -
imagePattern Pattern for image string \
\

| |slickSliderOptions|Slider plugin configuration array.For more information read official Slick slider documentation.|array|['slidesToShow' => '3', 'slidesToScroll' => '1', 'autoplay' => 'true', 'autoplaySpeed' => '2000']|, (*6)

Also you can append this slider to your Active Record model

Configuration

Add behavior to your Active Record model, (*7)

use yii\db\ActiveRecord;

/**
 * @property string $sliderKey
 * @property SliderContent[] $sliderContent
 */
class Article extends ActiveRecord
{
    public function behaviors()
    {
        return [
            // ...
            'slider' => [
                'class' => \bl\slider\common\behaviors\SliderBehavior::class
            ],
        ];
    }
}

Using

$article = new Article();
$article->sliderKey = "article-slider";

$slide_one = new SliderContent();
$slide_one->content = "img/slider/slider-1.jpg";
$slide_one->position = 1;

$slide_two = new SliderContent();
$slide_two->content = "img/slider/slider-2.jpg";
$slide_two->position = 2;

// slide N...

$article->sliderContent = $slide_one;
$article->sliderContent = $slide_two;
// or
$article->sliderContent = [$slide_one, $slide_two];

$article->save();

The Versions

10/09 2017

dev-master

9999999-dev

Module for adding image slider to site across dashboard

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vladimir Kuprienko

yii2 module slider carousel slick

10/09 2017

2.0.1

2.0.1.0

Module for adding image slider to site across dashboard

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vladimir Kuprienko

yii2 module slider carousel slick

27/12 2016

2.0.0

2.0.0.0

Module for adding image slider to site across dashboard

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vladimir Kuprienko

yii2 module slider carousel slick

15/12 2016

1.2.0

1.2.0.0

Module for adding sliders to site across dashboard

  Sources   Download

GNU Public License

The Requires

 

by Vladimir Kuprienko

yii2 module slider carousel slick

13/11 2016

1.1.0

1.1.0.0

  Sources   Download

GNU Public License

The Requires

 

by Vladimir Kuprienko

yii2 module widget slider slick

11/11 2016

1.0.0

1.0.0.0

  Sources   Download

GNU Public License

The Requires

 

by Vladimir Kuprienko

yii2 module widget slider slick

27/10 2016

0.1.0-beta

0.1.0.0-beta

  Sources   Download

GNU Public License

The Requires

 

by Vladimir Kuprienko

yii2 module widget slider slick