You are here

loft_data_grids.install in Loft Data Grids 8

Handles installation steps for loft_data_grids

File

loft_data_grids.install
View source
<?php

/**
 * @file
 * Handles installation steps for loft_data_grids
 *
 * @ingroup func_search
 * @{
 */

/**
 * Implements hook_requirements().
 *
 * Checks installation requirements and do status reporting.
 * http://api.drupal.org/api/function/hook_requirements
 *
 * @param phase 'install' or 'runtime':
 *
 * @return A keyed array of requirements
 */
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;
}

Functions