You are here

varbase_heroslider_media.install in Media Hero Slider 8.4

Install, update and uninstall functions for the varbase hero slider media.

File

varbase_heroslider_media.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the varbase hero slider media.
 */

/**
 * Implements hook_requirements().
 */
function varbase_heroslider_media_requirements($phase) {
  $requirements = [];
  $path = DRUPAL_ROOT . '/libraries/slick/slick/slick.min.js';

  // Is the library found in the root libraries path.
  $library_found = file_exists($path);

  // If library is not found, then look in the current profile libraries path.
  if (!$library_found) {
    $profile_path = drupal_get_path('profile', drupal_get_profile());
    $profile_path .= '/libraries/slick/slick/slick.min.js';

    // Is the library found in the current profile libraries path.
    $library_found = file_exists($profile_path);
  }
  if (!$library_found) {
    $requirements['slick_library'] = array(
      'title' => t('Slick library missing'),
      'description' => t('Media Hero Slider requires the slick.min.js library.
        Download it (https://github.com/kenwheeler/slick) and place it in the
        libraries folder (/libraries)'),
      'severity' => REQUIREMENT_ERROR,
    );
  }
  return $requirements;
}

Functions