function module_builder_page_module in Module Builder 5
Module form: 'module' step. Generate the module code.
1 call to module_builder_page_module()
- module_builder_page in ./
module_builder.module - Displays module builder interface via a multi-step form. The steps are:
File
- ./
module_builder.module, line 544 - Builds scaffolding for custom modules.
Code
function module_builder_page_module($form, $form_values) {
// Include link in breadcrumb to go back to main module builder form
/*
$breadcrumb = drupal_get_breadcrumb();
$breadcrumb[] = l(t('Module builder'), 'module_builder');
drupal_set_breadcrumb($breadcrumb);
*/
$code = $form_values['module_code'] ? $form_values['module_code'] : generate_module($form_values);
$info = $form_values['module_info'] ? $form_values['module_info'] : generate_info($form_values);
// damn I miss perl at times like this. fugly syntax.
$form['back'] = array(
'#type' => 'submit',
'#name' => 'op',
'#value' => t('Back'),
);
$form['code_instructions'] = array(
'#value' => t('Please copy and paste the following text into a file called !module.', array(
'!module' => $form_values['module_root_name'] . '.module',
)),
'#prefix' => '<div id="module-message">',
'#suffix' => '</div>',
);
$form['module_code'] = array(
'#type' => 'textarea',
'#title' => t('Module code'),
'#rows' => 20,
'#default_value' => $code,
'#prefix' => '<div id="module-code">',
'#suffix' => '</div>',
);
$form['download_module'] = array(
'#type' => 'submit',
'#name' => 'op',
'#value' => t('Download module'),
);
$form['write_module'] = array(
'#type' => 'button',
'#value' => t('Write module file'),
);
$form['info_instructions'] = array(
'#value' => t('Please copy and paste the following text into a file called !module.', array(
'!module' => $form_values['module_root_name'] . '.info',
)),
'#prefix' => '<div id="module-message">',
'#suffix' => '</div>',
);
$form['module_info'] = array(
'#type' => 'textarea',
'#title' => t('Module info'),
'#rows' => 20,
'#default_value' => $info,
'#prefix' => '<div id="module-info">',
'#suffix' => '</div>',
);
$form['download_info'] = array(
'#type' => 'submit',
'#name' => 'op',
'#value' => t('Download info file'),
);
$form['write_info'] = array(
'#type' => 'button',
'#value' => t('Write info file'),
);
$form['#multistep_excludes'] = array(
'module_code',
'module_info',
);
// handle the write buttons
$form['#after_build'] = array(
'module_builder_write_buttons',
);
return $form;
}