Commit 6ff2a977 authored by Oleh Vehera's avatar Oleh Vehera
Browse files

Issue #3147854 by Santhosh-Kumar-Rengasamy, voleger, Project Update Bot,...

Issue #3147854 by Santhosh-Kumar-Rengasamy, voleger, Project Update Bot, sunil.drupal, chegor, Sharique, Szeke, imclean, guilhermevp, piyushsms91, kazah, lorenzs, vishalgala, selinav: Automated Drupal 9 compatibility fixes
parent a332627f
Loading
Loading
Loading
Loading
+0 −18
Changes for README.txt: 0 added lines, 18 removed lines.
Original line number Diff line number Diff line
@@ -70,24 +70,6 @@ Installation
  Note: the requirement on the library is not in the module's composer.json
  because that would cause problems with automated testing.

-- INSTALLATION VIA DRUSH --

  A Drush command is provided for easy installation of the jCarousel plugin.

  drush jcarousel-plugin
  drush jcarousel-swipe-plugin

  The command will download the plugin and unpack it in "libraries".
  It is possible to add another path as an option to the command, but not
  recommended unless you know what you are doing.

-- MANUAL INSTALLATION --
1) Place this module directory in your modules folder (this will usually be
   "modules/contrib").
2) Download library https://github.com/jsor/jcarousel/archive/0.3.8.zip
  and extract it to your libraries folder
3) Enable the module within your Drupal site at Administration -> Extend (admin/modules).

Usage
-----
The jCarousel module is most commonly used with the Views module to turn

composer.json

0 → 100644
+46 −0
Changes for composer.json: 46 added lines, 0 removed lines.
Original line number Diff line number Diff line
{
    "name": "drupal/jcarousel",
    "description": "Slick carousel, the last carousel you'll ever need.",
    "keywords": [
        "carousel",
        "slideshow",
        "Drupal"
    ],
    "type": "drupal-module",
    "license": "GPL-2.0+",
    "homepage": "https://drupal.org/project/jcarousel",
    "support": {
        "issues": "https://drupal.org/project/issues/jcarousel",
        "source": "http://cgit.drupalcode.org/jcarousel"
    },
    "require": {
        "jsor/jcarousel": "~0.3",
        "snake-345/jcarouselswipe": "~0.3"
    },
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "jsor/jcarousel",
                "version": "0.3.8",
                "type": "drupal-library",
                "dist": {
                    "url": "https://github.com/jsor/jcarousel/archive/0.3.8.zip",
                    "type": "zip"
                }
            }
        },
        {
            "type": "package",
            "package": {
                "name": "snake-345/jcarouselswipe",
                "version": "0.3.7",
                "type": "drupal-library",
                "dist": {
                    "url": "https://github.com/snake-345/jcarouselswipe/archive/0.3.7.zip",
                    "type": "zip"
                }
            }
        }
    ]
}

drush/jcarousel.drush.inc

deleted100644 → 0
+0 −173
Changes for drush/jcarousel.drush.inc: 0 added lines, 173 removed lines.
Original line number Diff line number Diff line
<?php

/**
 * @file
 * Drush integration for jcarousel.
 */

/**
 * The jCarousel plugin URI.
 */
define('JCAROUSEL_DOWNLOAD_URI', 'https://github.com/jsor/jcarousel/archive/0.3.8.zip');
define('JCAROUSEL_SWIPE_DOWNLOAD_URIOAD_URI', 'https://github.com/snake-345/jcarouselSwipe/archive/0.3.7.zip');

/**
 * Implements hook_drush_command().
 */
function jcarousel_drush_command() {
  $items = [];

  // The key in the $items array is the name of the command.
  // No bootstrap.
  $items['jcarousel-plugin'] = [
    'callback' => 'drush_jcarousel_lib_plugin',
    'description' => dt('Download and install the jCarousel plugin.'),
    'bootstrap' => DRUSH_BOOTSTRAP_NONE,
    'arguments' => [
      'path' => dt('Optional. A path where to install the jCarousel plugin. If omitted Drush will use the default location.'),
    ],
    'aliases' => ['jcarouselplugin'],
  ];

  $items['jcarousel-swipe-plugin'] = [
    'callback' => 'drush_jcarousel_swipe_lib_plugin',
    'description' => dt('Download and install the jCarousel swipe plugin.'),
    'bootstrap' => DRUSH_BOOTSTRAP_NONE,
    'arguments' => [
      'path' => dt('Optional. A path where to install the jCarousel swipe plugin. If omitted Drush will use the default location.'),
    ],
    'aliases' => ['jcarouselswipeplugin'],
  ];

  return $items;
}

/**
 * Implements hook_drush_help().
 */
function jcarousel_drush_help($section) {
  if ($section == 'drush:jcarousel-plugin') {
    return dt('Download and install the jCarousel plugin from https://github.com/jsor/jcarousel, default location is /libraries.');
  }
  if ($section == 'drush:jcarousel-swipe-plugin') {
    return dt('Download and install the jCarousel plugin from https://github.com/jsor/jcarousel, default location is /libraries.');
  }
}

/**
 * Command to download the jCarousel plugin.
 */
function drush_jcarousel_lib_plugin() {
  $args = func_get_args();
  if (!empty($args[0])) {
    $path = $args[0];
  }
  else {
    $path = 'libraries';
  }

  // Create the path if it does not exist.
  if (!is_dir($path)) {
    drush_op('mkdir', $path);
    drush_log(dt('Directory @path was created', ['@path' => $path]), 'notice');
  }

  // Set the directory to the download location.
  $olddir = getcwd();
  chdir($path);

  // Download the zip archive.
  if ($filepath = drush_download_file(JCAROUSEL_DOWNLOAD_URI)) {
    $filename = basename($filepath);
    $dirname = basename($filepath, '.zip');

    // Remove any existing jCarousel plugin directory.
    if (is_dir($dirname) || is_dir('jcarousel')) {
      drush_delete_dir($dirname, TRUE);
      drush_delete_dir('jcarousel', TRUE);
      drush_log(dt('A existing jCarousel plugin was deleted from @path', ['@path' => $path]), 'notice');
    }

    // Decompress the zip archive.
    drush_tarball_extract($filename, $dirname);

    // Change the directory name to "jCarousel" if needed.
    if ($dirname != 'jcarousel') {
      drush_mkdir('jcarousel');
      chdir($dirname);
      drush_move_dir('jcarousel-0.3.8', '../jcarousel', TRUE);
      chdir('..');
      drush_delete_dir($dirname);
      $dirname = 'jcarousel';
    }
  }

  if (is_dir($dirname)) {
    drush_log(dt('jCarousel plugin has been installed in @path', ['@path' => $path]), 'success');
  }
  else {
    drush_log(dt('Drush was unable to install the jCarousel plugin to @path', ['@path' => $path]), 'error');
  }

  // Set working directory back to the previous working directory.
  chdir($olddir);
}

/**
 * Command to download the jCarousel plugin.
 */
function drush_jcarousel_swipe_lib_plugin() {
  $args = func_get_args();
  if (!empty($args[0])) {
    $path = $args[0];
  }
  else {
    $path = 'libraries';
  }

  // Create the path if it does not exist.
  if (!is_dir($path)) {
    drush_op('mkdir', $path);
    drush_log(dt('Directory @path was created', ['@path' => $path]), 'notice');
  }

  // Set the directory to the download location.
  $olddir = getcwd();
  chdir($path);

  // Download the zip archive.
  if ($filepath = drush_download_file(JCAROUSEL_SWIPE_DOWNLOAD_URIOAD_URI)) {
    $filename = basename($filepath);
    $dirname = basename($filepath, '.zip');

    // Remove any existing jCarousel plugin directory.
    if (is_dir($dirname) || is_dir('jcarouselSwipe')) {
      drush_delete_dir($dirname, TRUE);
      drush_delete_dir('jcarouselSwipe', TRUE);
      drush_log(dt('A existing jCarousel swipe plugin was deleted from @path', ['@path' => $path]), 'notice');
    }

    // Decompress the zip archive.
    drush_tarball_extract($filename, $dirname);

    // Change the directory name to "jCarousel" if needed.
    if ($dirname != 'jcarouselSwipe') {
      drush_mkdir('jcarouselSwipe');
      chdir($dirname);
      drush_move_dir('jcarouselSwipe-0.3.5', '../jcarouselSwipe', TRUE);
      chdir('..');
      drush_delete_dir($dirname);
      $dirname = 'jcarouselSwipe';
    }
  }

  if (is_dir($dirname)) {
    drush_log(dt('jCarousel swipe plugin has been installed in @path', ['@path' => $path]), 'success');
  }
  else {
    drush_log(dt('Drush was unable to install the jCarousel swipe plugin to @path', ['@path' => $path]), 'error');
  }

  // Set working directory back to the previous working directory.
  chdir($olddir);
}
+2 −2
Changes for jcarousel.module: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -356,7 +356,7 @@ function _jcarousel_help_views() {
  $views_description_start_details = '';
  if ($module_handler->moduleExists('views_ui')) {
    $views_description_start_details = t('You may configure a new view through the <a href=":views-url">Views module interface</a>. After adding a new view, change its "Display style" to "jCarousel" and configure the remaining options there. When using the jCarousel display style with Views, you can construct any of the examples on this page as well as dynamically loaded carousels through AJAX requests.',
      [':views-url' => url::fromRoute('entity.view.collection')->toString()]
      [':views-url' => Url::fromRoute('entity.view.collection')->toString()]
    );
    $views_description_start_details .= '' . t('For AJAX enabled views please use special jCarousel pager that supports page preload currectly.');
  }
@@ -393,7 +393,7 @@ function _jcarousel_help_backward_compatibility() {

  $global_usage  = t('For backward compatibility in opposite to Drupal 7 implementation using jcarousel_add() you should enable jCarousel globally via <a href=":config-url">module page configuration page </a> and configure jcarousel via <a href=":attributes-url">data atributes</a>.',
    [
      ':config-url' => url::fromRoute('jcarousel.config')->toString(),
      ':config-url' => Url::fromRoute('jcarousel.config')->toString(),
      ':attributes-url' => 'https://github.com/jsor/jcarousel/blob/master/examples/data-attributes/index.html',
    ]
  );
+1 −1
Changes for js/jcarousel.js: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -159,7 +159,7 @@
        type: 'jcarousel'
      },
      submit: viewData,
      element: element
      element: element[0] ?? element
    };

    Drupal.ajax(element_settings);