2017 © Pedro Peláez
 

asgard-module slider-module

Slider module for AsgardCMS

image

bociancz/slider-module

Slider module for AsgardCMS

  • Sunday, April 1, 2018
  • by becquerel
  • Repository
  • 3 Watchers
  • 6 Stars
  • 521 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 9 Open issues
  • 34 Versions
  • 27 % Grown

The README.md

Slider Module

IMPORTANT: Slider Module for AsgardCMS v1 and v2 is no longer maintained

For Asgard v1, use 0.x tagged releases, for Asgard v2 use 2.x tagged releases. Please upgrade Asgard to v3 if you wish to use the latest features (see changelog in releases for details), (*1)

Special Thanks

to Nicolas Widart for AsgardCMS and his Menu Module, that was used as a foundation for the Slider Module. All other contributors to this module, (*2)

Installation

Using Asgard module downloader

Module can be installed by running following command: php artisan asgard:download:module bociancz/slider, (*3)

Please DO NOT USE bociancz/slider-module as a package name when using Asgard module downloader. This will put module in Modules/SliderModule directory, which is not correct. Using bociancz/slider should do the trick., (*4)

Using Composer

You can install Slider module using composer: composer require bociancz/slider-module, (*5)

After the module is installed, Slider migrations should be installed automatically, as well as frontend assets. If by any chance they are not, you can run commands manually:, (*6)

  • to install Slider migrations php artisan module:migrate Slider
  • to publish frontend assets php artisan module:publish Slider

Do not forget to give yourself access in AsgardCMS (using Roles/Permissions). New Slider item will appear in the Sidebar, (*7)

Usage

Prerequisites

By default, Slider module is created using Bootstrap Carousel so make sure you have all prerequisites loaded for standard Bootstrap carousel (Bootstrap Carousel CSS and JS), (*8)

Basic Usage

You can create basic Slider using the AsgardCMS admin interface - you can create and name your slider (pay attention to the System Name field here, it is used later for rendering), and create individual slides. Slides can be linked to images in the Media module, or have URL pointing to external image. They can also contain hyperlink to any page on the site, fixed URI or URL., (*9)

When the slider is created, you can render it in your template using {!! Slider::render('slider_system_name') !}}, (*10)

Advanced Usage

Use your own slider template

If you want to change rendering of your slider, use custom HTML, CSS classes, etc, you can pass a Blade template name as a second parameter to the render() method, i.e. {!! Slider::render('slider_system_name', 'slider/my-own-slider') !}}, (*11)

Template may look like this:, (*12)

{-- Themes/MyTheme/views/slider/my-own-slider.blade.php --}


@foreach($slider->slides as $index => $slide) @endforeach

You will have Modules\Slider\Entities\Slider instance available in the $slider variable, (*13)

Provide your own Slider instance

You can also pass a Modules\Slider\Entities\Slider instance as a first parameter instead of the slider system_name to render dynamically created slider., (*14)

First, create instance of your slider and add slides in your controller and pass it to the view, (*15)

<?php
...
// import classes needed to create your own instance
use Modules\Slider\Entities\Slider;
use Modules\Slider\Entities\Slide;

class HomepageController {
    ...
    /**
     * controller method
     */
    public function displayHomepage()
    {
        // make a new Slider instance
        $mySlider = new Slider;
        $mySlider ->system_name = 'custom_slider';

        // create slide 1
        $slide1 = new Slide;
        $slide1->title = 'First Slide';
        $slide1->caption = 'First slide text';
        $slide1->external_image_url = 'https://placeholdit.imgix.net/~text?txtsize=33&txt=Slide1&w=800&h=300';

        // create slide 2
        $slide2 = new Slide;
        $slide2->title = 'Second Slide';
        $slide2->caption = 'Second slide text';
        $slide2->external_image_url = 'https://placeholdit.imgix.net/~text?txtsize=33&txt=Slide2&w=800&h=300';

        // add slides to slider
        $mySlider->slides->add($slide1);
        $mySlider->slides->add($slide2);

        // render view
        return View::make('homepage')
            ->with('mySlider', $mySlider);
    }

then, inside of the homepage.blade.php template, you can render slider using {!! Slider::render($mySlider) !!}, (*16)

Using Youtube video on a slide background (Bootstrap4 only supported)

You have the option to provide a Youtube video link for each slide. When using a default Bootstrap 4 template, this video will play on a background., (*17)

If image is provided at the same time, it will be displayed as a slide background before the video player loads (delay is set to 2 seconds by default), (*18)

All styles and javascripts are contained in the blade template (youtube-video-slide.blade.php) see https://www.powderkegwebdesign.com/implementing-youtube-background-videos/ for the original solution, (*19)

!!! When using a video on the background, you can currently only use it on a single slide. Videos on more than one slide will not play !!!, (*20)

Allow multiple images per slider

Sometimes, it is useful to be able to upload multiple images per slide (for example for hover effect, etc.). Slider module is configurable to support this usecase:, (*21)

  • first, publish configuration for the Slider module php artisan module:publish-config Slider. This will copy Slider module config files to /config/asgard/slider/
  • open /config/asgard/slider/config.php file
  • look for slide-images config block, by default looks like this:
'slide-images' => [
    'slideImage',
]
  • you can add more items in the slide-images array, and these will then be added to the create/edit slide form
'slide-images' => [
    'slideImage',
    'slideImage_hover',
    'slideImage_alternative',
]

(you will be able to attach three different images to each of your slides) * you can then access images in your templates by calling $slide->getImageUrl(1), where 1 is index of the attachment. * alternatively, you can also access image URL by specifying the zone $slide->getImageUrlByZone('slideImage_hover'), (*22)

Resources

The Versions

01/04 2018

dev-bugfix/api-route-names

dev-bugfix/api-route-names

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Cap

slider asgardcms

01/04 2018

dev-master

9999999-dev

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Cap

slider asgardcms

01/04 2018

v3.0.0

3.0.0.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Cap

slider asgardcms

01/04 2018

dev-bugfix/permission-fixes-for-3.0

dev-bugfix/permission-fixes-for-3.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Cap

slider asgardcms

23/11 2017

2.0.x-dev

2.0.9999999.9999999-dev

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

23/11 2017

v2.3.0

2.3.0.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

23/11 2017

dev-bugfix/laravel-54

dev-bugfix/laravel-54

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

23/11 2017

dev-bugfix/laravel54

dev-bugfix/laravel54

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

21/08 2017

v2.2.1

2.2.1.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

21/08 2017

dev-feature/v2-info

dev-feature/v2-info

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

21/08 2017

v2.2.0

2.2.0.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

21/08 2017

dev-feature/custom-html

dev-feature/custom-html

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

07/06 2017

v2.1.0

2.1.0.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

05/06 2017

dev-feature/spanish-translation-2.0

dev-feature/spanish-translation-2.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

05/06 2017

v0.4.7

0.4.7.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

23/05 2017

v2.0.1

2.0.1.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

23/05 2017

dev-bugfix/v2-composer-namespaces

dev-bugfix/v2-composer-namespaces

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

16/05 2017

v2.0.0

2.0.0.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

16/05 2017

0.4.6

0.4.6.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

30/11 2016

dev-feature/cs-translation

dev-feature/cs-translation

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

06/11 2016

0.4.5

0.4.5.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

06/11 2016

dev-bugfix/nonexisting-slider-render-fix

dev-bugfix/nonexisting-slider-render-fix

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

04/11 2016

0.4.4

0.4.4.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

04/11 2016

dev-feature/no-controls-for-single-slide

dev-feature/no-controls-for-single-slide

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

23/10 2016

0.4.3

0.4.3.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

23/10 2016

dev-bugfix/allActive

dev-bugfix/allActive

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

22/10 2016

0.4.2

0.4.2.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

22/10 2016

0.4.1

0.4.1.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

22/10 2016

0.4.0

0.4.0.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

21/10 2016

0.3.0

0.3.0.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

18/10 2016

0.2.0

0.2.0.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

10/10 2016

0.1.2

0.1.2.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

10/10 2016

0.1.1

0.1.1.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms

10/10 2016

0.1

0.1.0.0

Slider module for AsgardCMS

  Sources   Download

MIT

The Requires

 

by David Cap

slider asgardcms