You are here

function juicebox_requirements in Juicebox HTML5 Responsive Image Galleries 7.2

Same name and namespace in other branches
  1. 8.3 juicebox.install \juicebox_requirements()
  2. 8.2 juicebox.install \juicebox_requirements()
  3. 7 juicebox.install \juicebox_requirements()

Implements hook_requirements().

File

./juicebox.install, line 13
Install, update and uninstall functions for the Juicebox module.

Code

function juicebox_requirements($phase) {
  $requirements = array();
  $t = get_t();

  // Check on the installation status of the Juicebox library. Note that
  // we do not do this check during the 'install' phase as the libraries API
  // functions will not always be available then (if installing Drupal via an
  // install profile, etc.).
  if ($phase == 'runtime') {

    // Get locally installed library details.
    $library = juicebox_library_detect(TRUE, TRUE);
    $requirements['juicebox'] = array(
      'title' => $t('Juicebox Javascript Library'),
    );
    if ($library['installed']) {
      $requirements['juicebox']['value'] = $library['version'];
      $requirements['juicebox']['severity'] = REQUIREMENT_OK;
    }
    else {
      $requirements['juicebox']['value'] = $library['error'];
      $requirements['juicebox']['description'] = $library['error message'];
      $requirements['juicebox']['severity'] = REQUIREMENT_ERROR;
    }

    // Add notice about incompatibility with devel_themer.
    if (module_exists('devel_themer')) {
      $requirements['juicebox_devel_themer'] = array(
        'title' => 'Juicebox Compatibility',
        'value' => 'Theme Developer module is enabled',
        'description' => t('The Juicebox module is not compatible with the Theme Developer module. Your Juicebox galleries may not display correctly until the Theme Developer module has been disabled.'),
        'severity' => REQUIREMENT_ERROR,
      );
    }

    // Add notice about the fact that all logic from the juicebox_xml_cache
    // module has been added this module.
    if (module_exists('juicebox_xml_cache')) {
      $requirements['juicebox_xml_cache'] = array(
        'title' => 'Juicebox Compatibility',
        'value' => 'Juicebox XML cache module obsolete',
        'description' => t('The Juicebox XML Cache (sandbox) module is now obsolete. That module\'s primary functionality has been added to the main Juicebox module (as of version 7.x-2.1 of Juicebox) and is no longer needed. Please uninstall the Juicebox XML Cache module.'),
        'severity' => REQUIREMENT_ERROR,
      );
    }
  }
  return $requirements;
}