function flexslider_requirements in Flex Slider 7.2
Same name and namespace in other branches
- 8.2 flexslider.install \flexslider_requirements()
- 7 flexslider.install \flexslider_requirements()
Implements hook_requirements().
File
- ./
flexslider.install, line 79 - Installation actions for FlexSlider
Code
function flexslider_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time
$t = get_t();
// Check to see if the flexslider library is available
if ($phase == 'runtime') {
$library = libraries_detect('flexslider');
if ($library['installed']) {
$version = explode('.', $library['version']);
if ($version[0] == FLEXSLIDER_COMPATIBLE_MAJOR_VERSION) {
$requirements['flexslider'] = array(
'value' => $library['version'],
'severity' => REQUIREMENT_OK,
);
}
else {
$requirements['flexslider'] = array(
'value' => $library['version'],
'description' => $t('Incompatible version detected. The FlexSlider library version must be from the %version.x branch.', array(
'%version' => FLEXSLIDER_COMPATIBLE_MAJOR_VERSION,
)),
'severity' => REQUIREMENT_WARNING,
);
}
}
else {
$requirements['flexslider'] = array(
'value' => $t('FlexSlider library not found.'),
'description' => $t('The FlexSlider library could not be detected. Please consult the README.md for installation instructions.'),
'severity' => REQUIREMENT_ERROR,
);
}
$requirements['flexslider']['title'] = $t('FlexSlider');
}
return $requirements;
}