function views_isotope_requirements in Brainstorm profile 7
Implements hook_requirements().
File
- modules/
custom/ views_isotope/ views_isotope.install, line 112 - Installation functions.
Code
function views_isotope_requirements($phase) {
$requirements = [];
if ($phase == "runtime") {
$requirements['isotope'] = [
'title' => t('Isotope library'),
'value' => t('Enabled'),
];
$isotope_scope = views_isotope_check_library();
// If Libraries API is enabled but the .js is not found within the
// sites/all/libraries folder report a warning. The module will fall back to
// its included copy so this isn't a showstopper.
if (function_exists('libraries_get_path') && $isotope_scope == 'cdn') {
$path = libraries_get_path('isotope');
$path = !empty($path) ? $path : 'libraries/isotope';
$requirements['isotope']['value'] = t('Isotope is not correctly using Libraries API');
$requirements['isotope']['severity'] = REQUIREMENT_WARNING;
$requirements['isotope']['description'] = t('Please install <a href="http://isotope.metafizzy.co/">Isotope</a> in <strong>%path</strong>. The module is using an external copy from %cdn', [
'%path' => $path . '/' . VIEWS_ISOTOPE_FILENAME,
'%cdn' => VIEWS_ISOTOPE_CDN_PATH,
]);
}
// If the external copy has been removed or renamed report an error. At this
// point the module cannot function properly.
if ($isotope_scope == FALSE) {
$requirements['isotope']['value'] = t('Isotope is not correctly installed');
$requirements['isotope']['severity'] = REQUIREMENT_ERROR;
$requirements['isotope']['description'] = t('The external script is not available. Please enable the Libraries API module AND install <a href="http://isotope.metafizzy.co/">Isotope</a> in the isotope directory in libraries (sites/all/libraries/isotope/%file).', [
'%file' => VIEWS_ISOTOPE_FILENAME,
]);
}
}
return $requirements;
}