2017 © Pedro PelĂĄez
 

streams-addon swiper_block-extension

Swiper slider block extension for Pyrocms

image

pixney/swiper_block-extension

Swiper slider block extension for Pyrocms

  • Sunday, June 17, 2018
  • by Pixney-William
  • Repository
  • 0 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Installation

Add the following to the composer json file:, (*1)

{
  "repositories": [{
    "type": "composer",
    "url": "https://packages.pixney.com"
  }]
}

Require the block

composer require pixney/swiper_block-extension, (*2)

Dump

composer dump, (*3)

Install swiper

npm install swiper, (*4)

Install block

ÂŽphp artisan addon:install swiper_blockÂŽ, (*5)

Copy views

pb:swipe, (*6)

Init swiper (in app.js for example)

import Swiper from 'Swiper';
var mySwiper = new Swiper('.swiper-container', {
    preloadImages: false,
    lazy: true,

    // If we need pagination
    pagination: {
        el: '.swiper-pagination',
    },

    // Navigation arrows
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },

    // And if we need scrollbar
    scrollbar: {
        el: '.swiper-scrollbar',
    },

});

Edit views

When you have copied the views, you will be able to find these within your theme directory: resources/blocks/swiper_block, (*7)

Make Blocks work

Within your page view, to be able top render blocks add {{ page.block.render()|raw }} or read the documentation to see how to fully customize the output., (*8)

Make sure you read the Swiper documentation if you need to know how to use responsive images or set other configurations : Swiper Documentation, (*9)

Image ratio

Later on you will be able to set other ratios more easily. For now, if you don't want to use our 16:10 pre-set value. Simply run this command:php artisan make:migration change_swiper_ratio and then edit your file within database/migrations to look like this :, (*10)

<?php

use Anomaly\Streams\Platform\Database\Migration\Migration;

class ChangeSwiperRatio extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $field = $this->fields()->findBySlugAndNamespace('image', 'swiper_block');
        $field->setAttribute('config', [
            'aspect_ratio'=> '16:9' // Change this to whatever you want
        ])->save();
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        $field = $this->fields()->findBySlugAndNamespace('image', 'swiper_block');
        $field->setAttribute('config', [
            'aspect_ratio'=> '16:10'
        ])->save();
    }
}

Then run php artisan migrate. If you decide you set the wrong ratio. Just run php artisan migrate:rollback --step=1, change your file again and then run php artisan migrate., (*11)

Css

Make sure to import the swiper css file : @import '~swiper/dist/css/swiper.css'; and don't forget some styling like this on .swiper-background, (*12)

    .swiper-background {
        height: 100vh;
        background-size: cover;
    }

Anomaly Field Type Image

This extension won't work without it. Go PRO wih PyroCMS to get it!, (*13)

The Versions

17/06 2018

dev-master

9999999-dev https://pixney.com

Swiper slider block extension for Pyrocms

  Sources   Download

MIT

The Requires

 

extension block pyrocms swiper

17/06 2018

0.1.0

0.1.0.0 https://pixney.com

This is a very cool package!

  Sources   Download

MIT

The Requires

 

extension block pyrocms swiper

17/06 2018

0.1.14

0.1.14.0 https://pixney.com

Swiper slider block extension for Pyrocms

  Sources   Download

MIT

The Requires

 

extension block pyrocms swiper

17/06 2018

0.1.15

0.1.15.0 https://pixney.com

Swiper slider block extension for Pyrocms

  Sources   Download

MIT

The Requires

 

extension block pyrocms swiper

17/06 2018

0.1.16

0.1.16.0 https://pixney.com

Swiper slider block extension for Pyrocms

  Sources   Download

MIT

The Requires

 

extension block pyrocms swiper

17/06 2018

0.1.17

0.1.17.0 https://pixney.com

Swiper slider block extension for Pyrocms

  Sources   Download

MIT

The Requires

 

extension block pyrocms swiper