function _module_builder_invoke_hook in Module Builder 7
Same name and namespace in other branches
- 6.2 includes/common.inc \_module_builder_invoke_hook()
Helper function to invoke hook_module_builder_info() in all modules.
The tricky part is that we want to include ourselves, but module_builder might not be installed (or even present) in Drupal if we are on Drush.
2 calls to _module_builder_invoke_hook()
- _module_builder_get_hook_destinations in includes/
update_7.inc - Add extra data about hook destinations to the hook file data. This allows entire files or individual hooks to have a file other than the default %module.module as their destination.
- _module_builder_get_hook_file_urls in includes/
update.inc - Get list of hook file URLS from any modules that declare them.
File
- includes/
common.inc, line 215 - common.inc Stuff needed both by module and drush command.
Code
function _module_builder_invoke_hook() {
// TODO: just get ours if no bootstrap?
module_builder_include('common_version');
$mb_files = module_builder_system_listing('\\.module_builder.inc$', 'modules');
//print_r($mb_files);
$module_data = array();
foreach ($mb_files as $file) {
include_once $file->uri;
$module = str_replace('.module_builder.inc', '', $file->basename);
// Note that bad data got back from the hook breaks things.
if ($result = module_invoke($module, 'module_builder_info')) {
$module_data = array_merge($module_data, $result);
}
}
//print_r($module_data);
// If we are running as Drush command, we're not an installed module.
if (!module_exists('module_builder')) {
include_once dirname(__FILE__) . '/../module_builder.module_builder.inc';
$data = array_merge($module_data, module_builder_module_builder_info());
}
else {
$data = $module_data;
// Yeah we switch names so the merging above isn't affected by an empty array.
// Gah PHP. Am probably doin it wrong.
}
//print_r($data);
return $data;
}