You are here

function royalslider_requirements in RoyalSlider Integration 7

Implements hook_requirements().

Checks for the RoyalSlider library.

File

./royalslider.install, line 12
Installation hooks for RoyalSlider.

Code

function royalslider_requirements($phase) {
  $requirements = array();

  // Check for RoyalSlider library.
  if ($phase == 'runtime') {
    $path = libraries_get_path('royalslider');
    if (!$path || !file_exists("{$path}/jquery.royalslider.min.js")) {
      $requirements['royalslider_library'] = array(
        'description' => t('The <a href="@url">RoyalSlider library</a> should be installed at [libraries-path]/royalslider.', array(
          '@url' => 'http://dimsemenov.com/plugins/royal-slider/',
        )),
        'severity' => REQUIREMENT_ERROR,
        'value' => t('Not installed.'),
        'title' => t('RoyalSlider library'),
      );
    }

    // Also check for minimum required jQuery version.
    $jquery_version = variable_get('jquery_update_jquery_version', '1.5');
    if (!version_compare($jquery_version, '1.7', '>=')) {
      $requirements['royalslider_jquery_version'] = array(
        'description' => t('Incorrect jQuery version detected. RoyalSlider requires jQuery 1.7 or higher. Please change your <a href="!settings">jQuery Update settings</a>.', array(
          '!settings' => url('admin/config/development/jquery_update'),
        )),
        'severity' => REQUIREMENT_ERROR,
        'value' => t('Not installed. Please enable jQuery 1.7 or higher.'),
        'title' => t('RoyalSlider jQuery version'),
      );
    }
  }
  return $requirements;
}