You are here

bxslider.install in BxSlider 8

Same filename and directory in other branches
  1. 7 bxslider.install

Install, update and uninstall functions for the bxslider module.

File

bxslider.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the bxslider module.
 */

/**
 * Implements hook_requirements().
 */
function bxslider_requirements($phase) {
  if ($phase != 'runtime') {
    return [];
  }
  $library = \Drupal::service('library.discovery')
    ->getLibraryByName('bxslider', 'bxslider');
  $library_exists = file_exists(DRUPAL_ROOT . '/' . $library['js'][0]['data']);
  return [
    'bxslider_library_downloaded' => [
      'title' => t('Bxslider library'),
      'value' => $library_exists ? t('Installed') : t('Not installed'),
      'description' => $library_exists ? '' : t('The bxSlider library needs to be <a href="@url">downloaded</a> and extracted into the /libraries/bxslider folder in your Drupal installation directory.', [
        '@url' => 'https://github.com/stevenwanderski/bxslider-4/archive/master.zip',
      ]),
      'severity' => $library_exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
    ],
  ];
}

Functions

Namesort descending Description
bxslider_requirements Implements hook_requirements().