You are here

function module_builder_write_buttons in Module Builder 5

Form after build callback. If update button was clicked, update hooks documentation. Rest of form is not submitted. Cribbed from node_form_add_preview()

1 string reference to 'module_builder_write_buttons'
module_builder_page_module in ./module_builder.module
Module form: 'module' step. Generate the module code.

File

./module_builder.module, line 655
Builds scaffolding for custom modules.

Code

function module_builder_write_buttons($form) {
  static $been_here = FALSE;

  // ugly but I'm going round in circles trying to figure out how best to do this
  if ($been_here) {
    return $form;
  }
  $been_here = TRUE;
  global $form_values;
  $op = isset($form_values['op']) ? $form_values['op'] : '';
  if ($op == t('Write module file')) {
    _module_builder_write_file($form_values['module_root_name'], '.module', $form_values['module_code']);
  }
  elseif ($op == t('Write info file')) {
    _module_builder_write_file($form_values['module_root_name'], '.info', $form_values['module_info']);
  }
  return $form;
}