1 module_test.module | module_test_system_info_alter(&$info, $file, $type) |
Implements hook_system_info_alter().
Manipulate module dependencies to test dependency chains.
File
- core/
modules/ simpletest/ tests/ module_test.module, line 17
Code
function module_test_system_info_alter(&$info, $file, $type) {
if (state_get('dependency_test', FALSE) == 'missing dependency') {
if ($file->name == 'dependency_test3') {
// Make dependency_test3 module depend on dependency_test2.
$info['dependencies'][] = 'dependency_test2';
}
elseif ($file->name == 'dependency_test2') {
// Make dependency_test2 depend on a made-up, missing module.
$info['dependencies'][] = 'foo';
}
}
elseif (state_get('dependency_test', FALSE) == 'dependency') {
if ($file->name == 'dependency_test3') {
// Make the dependency_test3 module depend on dependency_test2.
$info['dependencies'][] = 'dependency_test2';
$info['hidden'] = FALSE;
}
elseif ($file->name == 'dependency_test2') {
// Make dependency_test2 depend on dependency_test1 module.
$info['dependencies'][] = 'dependency_test1';
$info['hidden'] = FALSE;
}
elseif ($file->name == 'dependency_test1') {
$info['hidden'] = FALSE;
}
}
elseif (state_get('dependency_test', FALSE) == 'version dependency') {
if ($file->name == 'dependency_test3') {
// Make the dependency_test3 module depend on dependency_test2.
$info['dependencies'][] = 'dependency_test2';
}
elseif ($file->name == 'dependency_test2') {
// Make dependency_test2 depend on a specific version of dependency_test1 module.
$info['dependencies'][] = 'dependency_test1 (1.x)';
}
elseif ($file->name == 'dependency_test1') {
// Set dependency_test1 module to a version compatible with the above.
$info['version'] = '1.x-1.0';
}
}
if ($file->name == 'seven' && $type == 'theme') {
$info['regions']['test_region'] = t('Test region');
}
}