You are here

function slickgrid_requirements in Slickgrid 7

Same name and namespace in other branches
  1. 7.2 slickgrid.install \slickgrid_requirements()

Implementation of hook_requirements().

File

./slickgrid.install, line 6

Code

function slickgrid_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    $t = get_t();
    $slickgrid_library = drupal_get_library('slickgrid', 'slickgrid');
    foreach ($slickgrid_library['js'] as $path => $js) {
      if (!file_exists($path)) {
        $requirements['slickgrid'] = array(
          'severity' => REQUIREMENT_ERROR,
          'title' => $slickgrid_library['title'],
          'value' => $t('Missing'),
          'description' => $t('The slickgrid library isn\'t available so this module will not work. Please download slickgrid %version from !website.', array(
            '!website' => l($slickgrid_library['website'], $slickgrid_library['website']),
            '%version' => $slickgrid_library['version'],
          )),
        );
        break;
      }
    }
    if (!isset($requirements['slickgrid'])) {
      $requirements['slickgrid'] = array(
        'severity' => REQUIREMENT_OK,
        'title' => $slickgrid_library['title'],
        'value' => $slickgrid_library['version'],
      );
    }
  }
  return $requirements;
}