You are here

function module_builder_page in Module Builder 7.2

Same name and namespace in other branches
  1. 5 module_builder.module \module_builder_page()
  2. 6.2 includes/module_builder.pages.inc \module_builder_page()
  3. 7 includes/module_builder.pages.inc \module_builder_page()

Displays module builder interface via a multi-step form. The steps are:

  • input => shows a form where the user can enter module options.
  • module => shows the generated module and info files.
  • download => pushes a file for download.
  • write => writes files.

Parameters

$form_values will be NULL when the page is first displayed,: when the form is submitted, this will be an array of the submitted values.

Return value

One of three results depending on the state of this multi-step form. Form for entering module options Form showing built module and info file Nothing, but file is pushed to client for download

Related topics

1 string reference to 'module_builder_page'
module_builder_menu in ./module_builder.module
Implementation of hook_menu().

File

includes/module_builder.pages.inc, line 35
Menu callback for main module builder page.

Code

function module_builder_page($form, &$form_state) {
  module_builder_init_library();

  // Set up multistep form.
  // Once again, thank you examples.module!
  if (empty($form_state['step'])) {
    $form_state['step'] = 'input';

    // This array contains the function to be called at each step to get the
    // relevant form elements. It will also store state information for each
    // step.
    $form_state['step_information'] = array(
      'input' => 'module_builder_page_input',
      'generate' => 'module_builder_page_generate',
    );
  }

  // Call the function named in $form_state['step_information'] to get the
  // form elements to display for this step.
  $form_builder_function = $form_state['step_information'][$form_state['step']];
  $form = $form_builder_function($form, $form_state);
  return $form;
}