You are here

function fitvids_requirements in FitVids 7

Same name and namespace in other branches
  1. 8 fitvids.install \fitvids_requirements()
  2. 6 fitvids.install \fitvids_requirements()

If the plugin doesn't exist, show a warning on the status page

File

./fitvids.install, line 12
Install, update and uninstall functions for the Fitvids module.

Code

function fitvids_requirements($phase) {
  $requirements = array();
  switch ($phase) {
    case 'runtime':
      $path = libraries_get_path('fitvids') . '/jquery.fitvids.js';
      $installed = file_exists($path);
      if (!$installed) {
        $requirements[] = array(
          'title' => t('FitVids jQuery plugin'),
          'value' => t('Missing'),
          'description' => t('The FitVids jQuery plugin is missing. Download it from !fitvids-site and copy it to !fitvids-library/!fitvids-filename.', array(
            '!fitvids-site' => l(FITVIDS_PLUGIN_URL, FITVIDS_PLUGIN_URL, array(
              'external' => TRUE,
            )),
            '!fitvids-library' => libraries_get_path('fitvids'),
            '!fitvids-filename' => FITVIDS_PLUGIN_FILENAME,
          )),
          'severity' => REQUIREMENT_ERROR,
        );
      }
      else {
        $requirements[] = array(
          'title' => t('FitVids jQuery plugin'),
          'value' => t('Installed'),
          /*'description' => t('FitVids is available at !fitvids-library/!fitvids-filename.', array(
              '!fitvids-library' => libraries_get_path('fitvids'),
              '!fitvids-filename' => FITVIDS_PLUGIN_FILENAME,
            )),*/
          'severity' => REQUIREMENT_OK,
        );
      }
      break;
  }
  return $requirements;
}