1 install.inc | backdrop_check_module($module) |
Checks a module's requirements.
Parameters
$module: Machine name of module to check.
Return value
TRUE or FALSE, depending on whether the requirements are met.:
File
- core/
includes/ install.inc, line 1452 - API functions for installing modules and themes.
Code
function backdrop_check_module($module) {
module_load_install($module);
if (module_hook($module, 'requirements')) {
// Check requirements.
$requirements = module_invoke($module, 'requirements', 'install');
if (is_array($requirements) && backdrop_requirements_severity($requirements) == REQUIREMENT_ERROR) {
// Print any error messages.
foreach ($requirements as $requirement) {
if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) {
$message = $requirement['description'];
if (isset($requirement['value']) && $requirement['value']) {
$message .= ' (' . t('Currently using !item !version', array('!item' => $requirement['title'], '!version' => $requirement['value'])) . ')';
}
backdrop_set_message($message, 'error');
}
}
return FALSE;
}
}
return TRUE;
}