You are here

function _loft_data_grids_requirements in Loft Data Grids 8

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 = [];
  $t = 't';
  if ($phase == 'runtime') {
    $info = loft_data_grids_info();

    // @FIXME
    // l() expects a Url object, created from a route name or external URI.
    // $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'])) {

      // @FIXME
      // l() expects a Url object, created from a route name or external URI.
      // $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'])) {

      // @FIXME
      // l() expects a Url object, created from a route name or external URI.
      // $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;
}