Commit 7b4ae861 authored by grisendo's avatar grisendo
Browse files

Requirements (library colorbox downloaded)

parent c0635e14
......@@ -8,39 +8,35 @@
/**
* Implements hook_requirements().
*/
/*
function colorbox_requirements($phase) {
return;
$requirements = array();
if ($phase == 'runtime') {
//$t = get_t();
$t = 't';
//$library = libraries_detect('colorbox');
$library = libraries_detect('colorbox');
$error_type = isset($library['error']) ? drupal_ucfirst($library['error']) : '';
$error_message = isset($library['error message']) ? $library['error message'] : '';
if (empty($library['installed'])) {
$requirements['colorbox_plugin'] = array(
'title' => $t('Colorbox plugin'),
'value' => $t('@e: At least @a', array('@e' => $error_type, '@a' => COLORBOX_MIN_PLUGIN_VERSION)),
'title' => t('Colorbox plugin'),
'value' => t('@e: At least @a', array('@e' => $error_type, '@a' => COLORBOX_MIN_PLUGIN_VERSION)),
'severity' => REQUIREMENT_ERROR,
'description' => $t('!error You need to download the !colorbox, extract the archive and place the colorbox directory in the %path directory on your server.', array('!error' => $error_message, '!colorbox' => l($t('Colorbox plugin'), $library['download url']), '%path' => 'sites/all/libraries')),
'description' => t('!error You need to download the !colorbox, extract the archive and place the colorbox directory in the %path directory on your server.', array('!error' => $error_message, '!colorbox' => l(t('Colorbox plugin'), $library['download url']), '%path' => 'sites/all/libraries')),
);
}
elseif (version_compare($library['version'], COLORBOX_MIN_PLUGIN_VERSION, '>=')) {
$requirements['colorbox_plugin'] = array(
'title' => $t('Colorbox plugin'),
'title' => t('Colorbox plugin'),
'severity' => REQUIREMENT_OK,
'value' => $library['version'],
);
}
else {
$requirements['colorbox_plugin'] = array(
'title' => $t('Colorbox plugin'),
'value' => $t('At least @a', array('@a' => COLORBOX_MIN_PLUGIN_VERSION)),
'title' => t('Colorbox plugin'),
'value' => t('At least @a', array('@a' => COLORBOX_MIN_PLUGIN_VERSION)),
'severity' => REQUIREMENT_ERROR,
'description' => $t('You need to download a later version of the !colorbox and replace the old version located in the %path directory on your server.', array('!colorbox' => l($t('Colorbox plugin'), $library['download url']), '%path' => $library['library path'])),
'description' => t('You need to download a later version of the !colorbox and replace the old version located in the %path directory on your server.', array('!colorbox' => l(t('Colorbox plugin'), $library['download url']), '%path' => $library['library path'])),
);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment