You are here

function module_builder_build in Module Builder 6

Builder form

Parameters

$form_state: The form state (from form.inc). Passed into the callback.

$callback: The callback function

$mid: The module id

$type: The name of the component (menu, node, comment)

Return value

An FAPI form array

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

File

./module_builder.api.inc, line 77
API functions for the module_builder module

Code

function module_builder_build(&$form_state, $module, $type) {
  $result = db_result(db_query("SELECT name FROM {module_builder_basic} WHERE mid = %d", $module->mid));
  drupal_set_title($result);
  $components = module_builder_get_components();
  $component = $components[$type];
  $result = unserialize(db_result(db_query("SELECT data FROM {module_builder_data} WHERE mid = %d AND type = '%s'", $module->mid, $type)));
  $values = $result !== FALSE ? $result : new stdClass();
  $form = $component['callback']($form_state, $values, $module);
  if ($component['submit_button']) {
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Submit'),
    );
  }
  $form['#submit'][] = $component['submit'];
  $form['mid'] = array(
    '#type' => 'value',
    '#value' => $module->mid,
  );
  $form['type'] = array(
    '#type' => 'value',
    '#value' => $type,
  );
  return $form;
}