function addtohomescreen_requirements in Add to homescreen 7
Same name and namespace in other branches
- 8 addtohomescreen.install \addtohomescreen_requirements()
Implements hook_requirements().
File
- ./
addtohomescreen.install, line 10 - Install, update and uninstall functions for the addtohomescreen module.
Code
function addtohomescreen_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time.
$t = get_t();
if ($phase == 'runtime') {
if (!function_exists('libraries_detect')) {
$requirements['addtohomescreen'] = array(
'title' => $t('Add to homescreen'),
'value' => $t('Libraries module is not installed.'),
'description' => $t('Add to homescreen requires the Libraries module. Please install it from <a href="@download_url">here</a>.', array(
'@download_url' => 'http://www.drupal.org/project/libraries',
)),
'severity' => REQUIREMENT_ERROR,
);
return $requirements;
}
if (($library = libraries_detect('addtohomescreen')) && !empty($library['installed'])) {
$requirements['addtohomescreen'] = array(
'title' => $t('Add to homescreen version'),
'value' => $library['version'],
'severity' => REQUIREMENT_OK,
);
}
else {
$requirements['addtohomescreen'] = array(
'title' => $t('Add to homescreen'),
'value' => $t('Add to homescreen library could not be found, check the <a href="@readme_url">installation instructions</a> for the Add to homescreen module.', array(
'@readme_url' => '/' . drupal_get_path('module', 'addtohomescreen') . '/README.txt',
)),
'severity' => REQUIREMENT_ERROR,
);
}
}
return $requirements;
}