You are here

function acquia_lift_requirements in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 8.4 acquia_lift.install \acquia_lift_requirements()
  2. 8 acquia_lift.install \acquia_lift_requirements()
  3. 8.3 acquia_lift.install \acquia_lift_requirements()
  4. 7.2 acquia_lift.install \acquia_lift_requirements()

Implements hook_requirements().

File

./acquia_lift.install, line 80
Acquia Lift - Installation file.

Code

function acquia_lift_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {

    // Required JavaScript libraries.
    $libraries = array(
      'underscore',
      'backbone',
      'modernizr',
      'chosen',
      'qtip',
      'd3',
      'rickshaw',
    );
    foreach ($libraries as $lib) {
      $requirements['acquia_lift_' . $lib] = array(
        'title' => t('Acquia Lift: @library', array(
          '@library' => $lib,
        )),
        'value' => t('The @library library is not present', array(
          '@library' => $lib,
        )),
        'severity' => REQUIREMENT_ERROR,
      );
      if (function_exists('libraries_detect')) {
        if (($library = libraries_detect($lib)) && !empty($library['installed'])) {
          $requirements['acquia_lift_' . $lib]['value'] = $library['version'];
          $requirements['acquia_lift_' . $lib]['severity'] = REQUIREMENT_OK;
        }
        elseif (!empty($library['error'])) {
          $requirements['acquia_lift_' . $lib]['value'] = $library['error message'];
        }
      }
    }
  }
  return $requirements;
}