function module_builder_callback_module in Module Builder 7
Handles the callback for module code generation.
Parameters
$commands: The drush array of commands.
$module_data: An array of module data. Passed by reference so file information can be added by module_builder_generate_module().
$build_list: An array of requested code files to output 'code' or 'all' means all of them.
1 call to module_builder_callback_module()
- module_builder_callback_build in drush/
module_builder.drush.inc - Module builder drush command callback.
File
- drush/
module_builder.drush.inc, line 261 - Module builder drush commands.
Code
function module_builder_callback_module($commands, &$module_data, $build_list) {
// The first argument is the module machine name.
array_shift($commands);
foreach ($commands as $hook_name) {
$module_data['hooks']["hook_{$hook_name}"] = TRUE;
}
//drush_print_r($module_data);
//exit;
/*
$input = drush_input('input?...');
drush_print("You entered: >$input<");
*/
// Generate all our code.
$module_code = module_builder_generate_module($module_data, drush_get_option('add'));
if (is_null($module_code)) {
return drush_set_error('DRUSH_NOT_COMPLETED', 'No module code has been generated: perhaps you have specified invalid hook names or hooks this module does not know about.');
}
//print_r($build_list);
if (!in_array($build_list[0], array(
'code',
'all',
))) {
// We have keys in module_code that are entire filenames, eg 'foo.install'
// We have array items in build_list that are sort of file endings, eg 'install'
// Match them up!
$requested_files = module_builder_requested_filenames($module_data['module_root_name'], array_keys($module_code), $build_list);
}
else {
// Meh we want the lot.
$requested_files = array_keys($module_code);
}
//print_r($requested_files);
foreach ($requested_files as $filename) {
$code = $module_code[$filename];
module_builder_drush_output_code($module_data['module_root_name'], $filename, $code);
}
return;
}