function cpf_requirements in CPF 8
Implments hook_requirements().
File
- ./
cpf.install, line 11 - Installation actions for CPF.
Code
function cpf_requirements($phase) {
$requirements = [];
// Check to see if the jQuery Mask Plugin library is available.
if ($phase == 'runtime') {
$library = libraries_detect('mask_plugin');
if ($library && !empty($library['installed'])) {
if ($library['version']) {
$description = t('Version %i installed', [
'%i' => $library['version'],
]);
}
else {
$description = t('Unable to detect version.');
}
$requirements['mask_plugin'] = [
'title' => t('jQuery Mask Plugin'),
'description' => $description,
'severity' => REQUIREMENT_OK,
];
}
else {
$requirements['mask_plugin'] = [
'title' => t('jQuery Mask Plugin'),
'description' => t('jQuery Mask Plugin library not found. Please consult the README.md for installation instructions.'),
'severity' => REQUIREMENT_ERROR,
];
}
}
return $requirements;
}