function nivo_slider_requirements in Nivo Slider 7
Implements hook_requirements().
File
- ./
nivo_slider.module, line 14 - Primarily Drupal hooks.
Code
function nivo_slider_requirements($phase) {
// Create an array to hold Nivo Slider requirements
$requirements = array();
// Check requirements during the runtime phase
if ($phase == 'runtime') {
// Check if the Nivo Slider jQuery plugin library is installed
if (($library = libraries_detect('nivo-slider')) && !empty($library['installed'])) {
$requirements['nivo_slider_library'] = array(
'title' => t('Nivo Slider jQuery plugin'),
'value' => t('Installed'),
'severity' => REQUIREMENT_OK,
);
}
else {
$requirements['nivo_slider_library'] = array(
'title' => t('Nivo Slider jQuery plugin'),
'value' => t('Not installed'),
'description' => $library['error message'],
'severity' => REQUIREMENT_ERROR,
);
}
// Check if the site is running >= jQuery 1.7
if (($library = drupal_get_library('system', 'jquery')) && version_compare($library['version'], 1.7) >= 0) {
$requirements['nivo_slider_jquery'] = array(
'title' => t('Nivo Slider jQuery version'),
'value' => t('jQuery @version', array(
'@version' => $library['version'],
)),
'severity' => REQUIREMENT_OK,
);
}
else {
$destination = drupal_get_destination();
$requirements['nivo_slider_jquery'] = array(
'title' => t('Nivo Slider jQuery version'),
'value' => t('jQuery @version', array(
'@version' => $library['version'],
)),
'description' => t('Nivo Slider requires jQuery 1.7 or greater. Configure <a href="@jquery_update">jQuery Update</a>.', array(
'@jquery_update' => url('admin/config/development/jquery_update', array(
'query' => $destination,
)),
)),
'severity' => REQUIREMENT_ERROR,
);
}
}
return $requirements;
}