You are here

function loft_data_grids_requirements in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 loft_data_grids.install \loft_data_grids_requirements()
  2. 7 loft_data_grids.install \loft_data_grids_requirements()

Implements hook_requirements().

Checks installation requirements and do status reporting. http://api.drupal.org/api/function/hook_requirements

Parameters

phase 'install' or 'runtime'::

Return value

A keyed array of requirements

File

./loft_data_grids.install, line 20
Handles installation steps for loft_data_grids

Code

function loft_data_grids_requirements($phase) {
  $reqs = array();
  $t = get_t();
  if ($phase == 'runtime') {
    $info = loft_data_grids_info();
    $reqs['loft_data_grids'] = array(
      'title' => $info['name'],
      'value' => isset($info['homepage']) ? l($info['version'], $info['homepage']) : $info['version'],
      'severity' => REQUIREMENT_OK,
    );
    if (empty($info['installed'])) {
      $reqs['loft_data_grids']['value'] = isset($info['homepage']) ? l('Not found!', $info['homepage']) : 'Not found!';
      $reqs['loft_data_grids']['description'] = $t('The Loft Data Grids dependencies are missing; see README for installation instructions.');
      $reqs['loft_data_grids']['severity'] = REQUIREMENT_ERROR;
    }
    elseif (empty($info['loaded'])) {
      $reqs['loft_data_grids']['value'] = isset($info['homepage']) ? l('Not loaded!', $info['homepage']) : 'Not loaded!';
      $reqs['loft_data_grids']['description'] = $t('The Loft Data Grids dependencies were found but not loaded; see README for installation instructions.');
      $reqs['loft_data_grids']['severity'] = REQUIREMENT_ERROR;
    }
  }
  return $reqs;
}