function loft_data_grids_requirements in Loft Data Grids 7
Same name and namespace in other branches
- 6.2 loft_data_grids.install \loft_data_grids_requirements()
- 7.2 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 19 - Handles installation steps for loft_data_grids
Code
function loft_data_grids_requirements($phase) {
$reqs = array();
$t = get_t();
if ($info = libraries_detect('loft_data_grids')) {
$info = libraries_load('loft_data_grids');
}
if ($phase === 'update' && empty($info['loaded'])) {
$reqs['loft_data_grids'] = array(
'title' => check_plain($info['name']),
'value' => $t('Not Found!'),
'description' => $t('The Loft Data Grids library is missing; see README for installation instructions.'),
'severity' => REQUIREMENT_ERROR,
);
}
elseif ($phase == 'runtime') {
if (empty($info)) {
$info = array(
'name' => 'Loft Data Grids',
'version' => '',
);
}
$reqs['loft_data_grids'] = array(
'title' => check_plain($info['name']),
'value' => check_plain($info['version']),
'description' => $t('Successfully loaded library from %path.', array(
'%path' => libraries_get_path('loft_data_grids'),
)),
'severity' => REQUIREMENT_OK,
);
if (empty($info['installed'])) {
$reqs['loft_data_grids']['value'] = $t('Not Found!');
$reqs['loft_data_grids']['description'] = $t('The Loft Data Grids library is missing; see README for installation instructions.');
$reqs['loft_data_grids']['severity'] = REQUIREMENT_ERROR;
}
elseif (empty($info['loaded'])) {
$reqs['loft_data_grids']['value'] = $t('Not Loaded!');
$reqs['loft_data_grids']['description'] = $t('The Loft Data Grids library was found but not loaded; see README for installation instructions.');
$reqs['loft_data_grids']['severity'] = REQUIREMENT_ERROR;
}
$exporters = loft_data_grids_export_info();
if ($reqs['loft_data_grids']['severity'] === REQUIREMENT_OK && ($missing = array_diff(_loft_data_get_possible_exporters(), array_keys($exporters)))) {
$reqs['loft_data_grids']['description'] .= $t(' However, the following Exporters have unmet dependencies and are not available: @list.', array(
'@list' => implode(', ', $missing),
));
$reqs['loft_data_grids']['severity'] = REQUIREMENT_WARNING;
}
}
return $reqs;
}