You are here

function joyride_requirements in Joyride JQuery for Drupal Site Tours 7

Implements hook_requirements(). Check installation requirements and do status reporting.

See also

http://api.drupalize.me/api/drupal/function/hook_requirements/7

File

./joyride.install, line 9

Code

function joyride_requirements($phase) {
  $requirements = array();
  $t = get_t();
  module_load_include('module', 'libraries');
  $library = $library = libraries_detect('joyride');
  $library_installed = $library && !empty($library['installed']);
  $js_name = 'jquery.joyride-' . JOYRIDE_LIBRARY_VERSION . '.js';
  $base_path = 'sites/all/libraries/joyride';
  switch ($phase) {
    case 'runtime':
      $requirements['joyride'] = array(
        'title' => $t('Zurb Joyride jQuery plugin'),
        'value' => $t('Not installed'),
        'description' => $t('Please download !url jQuery plugin and extract it to @path, so @js can be found at @full_path. Also please purge version info from Joyride file names (both .js and .css).', array(
          '!url' => l($t('Zurb Joyride'), 'https://github.com/zurb/joyride'),
          '@path' => $base_path,
          '@js' => $js_name,
          '@full_path' => $base_path . '/' . $js_name,
        )),
        'severity' => REQUIREMENT_ERROR,
      );
      if ($library_installed) {
        $requirements['joyride'] = array(
          'title' => $t('Zurb Joyride jQuery plugin'),
          'value' => $t('Installed'),
          'severity' => REQUIREMENT_OK,
        );
      }
      break;
  }
  return $requirements;
}