You are here

function flot_requirements in Flot 7

Implements hook_requirements().

File

./flot.module, line 6

Code

function flot_requirements($phase) {
  $requirements = array();

  // Check for the flot library.
  if (file_exists(_flot_get_library_path() . '/jquery.flot.js')) {
    $requirements['flot'] = array(
      'value' => t('Flot library found at !path', array(
        '!path' => _flot_get_library_path() . '/jquery.flot.js',
      )),
    );
  }
  else {
    $path = module_exists('libraries') ? 'sites/all/libraries/flot or ' . drupal_get_path('module', 'flot') . '/flot' : drupal_get_path('module', 'flot') . '/flot';
    $requirements['flot'] = array(
      'value' => t('Not installed'),
      'severity' => REQUIREMENT_ERROR,
      'description' => t('The flot library was not installed. !download the flot library and extract it to %path so that the file jquery.flot.js can be found at %flotpath', array(
        '!download' => l('Download', 'http://code.google.com/p/flot/downloads/list', array(
          'attributes' => array(
            'title' => t('Download flot'),
          ),
        )),
        '%path' => $path,
        '%flotpath' => $path . '/jquery.flot.js',
      )),
    );
  }
  $requirements['flot']['title'] = t('Flot Library');
  return $requirements;
}