function context_menu_block_requirements in Context: Menu Block 7.3
Same name and namespace in other branches
- 6.3 context_menu_block.install \context_menu_block_requirements()
Implementation of hook_requirements().
File
- ./
context_menu_block.install, line 40 - Install file for Context: Menu Block.
Code
function context_menu_block_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
$t = get_t();
$info = drupal_parse_info_file(drupal_get_path('module', 'context') . '/context.info');
// Check to see if Context's version is defined in its .info file.
// If it isn't, assume it's a git checkout and that the user knows what
// they're doing.
if (!isset($info['version'])) {
variable_set('context_menu_block_validate', TRUE);
$requirements['context_menu_block'] = array(
'title' => $t('Context'),
'value' => $t('Version tag not found'),
'severity' => REQUIREMENT_WARNING,
'description' => $t('Context does not have a version defined in its .info file. This could be because you are using a checkout of its git repository. For Context: Menu Block support, make sure you are using the @branch branch of Context.', array(
'@branch' => CONTEXT_MENU_BLOCK_CONTEXT_SUPPORTED,
)),
);
return $requirements;
}
$requirements['context_menu_block'] = array(
'title' => $t('Context'),
'value' => $info['version'],
);
if (_context_menu_block_validate_context($info['version'])) {
$requirements['context_menu_block']['severity'] = REQUIREMENT_OK;
$requirements['context_menu_block']['description'] = $t('The correct version of Context is enabled for use with Context: Menu Block.');
}
else {
$requirements['context_menu_block']['severity'] = REQUIREMENT_ERROR;
$requirements['context_menu_block']['description'] = $t('The version of Context enabled is not supported with Context: Menu Block. Download and enable the @branch branch of Context.', array(
'@branch' => CONTEXT_MENU_BLOCK_CONTEXT_SUPPORTED,
));
}
}
return $requirements;
}