You are here

function chosen_requirements in Chosen 7.3

Same name and namespace in other branches
  1. 8.2 chosen.install \chosen_requirements()
  2. 6 chosen.install \chosen_requirements()
  3. 7 chosen.install \chosen_requirements()
  4. 7.2 chosen.install \chosen_requirements()
  5. 3.0.x chosen.install \chosen_requirements()

Implements hook_requirements().

File

./chosen.install, line 10
Installation and uninstallation functions.

Code

function chosen_requirements($phase) {
  $requirements = array();
  module_load_include('module', 'chosen');
  $t = get_t();
  $chosen_path = chosen_get_chosen_path();
  switch ($phase) {
    case 'install':
      if (!$chosen_path) {
        $requirements['chosen_js'] = array(
          'description' => $t('You need to download the !chosen and extract the entire contents of the archive into the %path directory on your server.', array(
            '!chosen' => l($t('Chosen JavaScript file'), CHOSEN_WEBSITE_URL),
            '%path' => 'sites/all/libraries',
          )),
          'severity' => REQUIREMENT_ERROR,
        );
      }
      break;
    case 'runtime':
      if (!$chosen_path) {
        $requirements['chosen_js'] = array(
          'title' => $t('Chosen JavaScript file'),
          'severity' => REQUIREMENT_ERROR,
          'description' => $t('You need to download the !chosen and extract the entire contents of the archive into the %path directory on your server.', array(
            '!chosen' => l($t('Chosen JavaScript file'), CHOSEN_WEBSITE_URL),
            '%path' => 'sites/all/libraries',
          )),
          'value' => $t('Not Installed'),
        );
      }
      else {
        $requirements['chosen_js'] = array(
          'title' => $t('Chosen JavaScript file'),
          'severity' => REQUIREMENT_OK,
          'value' => $t('Installed'),
        );
      }
      break;
  }
  return $requirements;
}