You are here

function arrange_fields_display_form in Arrange Fields 6

Same name and namespace in other branches
  1. 7 arrange_fields.module \arrange_fields_display_form()

This function displays the arrangement form, where the user will be able to actually drag and drop to arrange fields. In it, we actually load the form which they are arranging, but we will be saving our data to our own form.

Parameters

string $form_type:

Return value

string

1 string reference to 'arrange_fields_display_form'
arrange_fields_menu in ./arrange_fields.module
Implementation of hook_menu().

File

./arrange_fields.module, line 1039

Code

function arrange_fields_display_form($form_type) {
  drupal_set_title("Arrange fields - {$form_type}");
  $rtn = "";
  $form_id = $form_type . "_node_form";
  $position_data = variable_get("arrange_fields_position_data_{$form_id}", FALSE);
  if ($position_data) {

    // Meaning, we have position data already for this form, so it is NOT
    // a brand-new form.  So, we should not pass "true" to the javascript
    // function arrangeFieldsRepositionToGrid.  Let's add a drupal
    // setting so we know that is the case.
    drupal_add_js(array(
      "arrangeFieldsNotNewForm" => TRUE,
    ), "setting");
  }
  arrange_fields_add_arrange_css_js();

  // We want to get the form which will let us save the position
  // information.
  $rtn .= drupal_get_form("arrange_fields_position_form", $form_id, $form_type);
  $rtn .= "<div>" . t("Use this form to drag-and-drop fields into the order which\n          you want them to appear on the node/edit page.") . "</div>\n          <div>" . t("You may resize text fields by dragging the right side\n              of the field.") . "</div>";
  $rtn .= "<input type='button' value='add markup' onClick='arrangeFieldsDialogEditMarkup(\"new\");'>";

  // The form we will be rearranging...
  $GLOBALS["arrange_fields_editing"] = $form_id;
  $GLOBALS["arrange_fields_editing_type"] = $form_type;
  $node_form = new stdClass();
  $node_form->type = $form_type;
  $rtn .= drupal_get_form($form_id, $node_form, $my_form_state);
  $rtn .= "<div>" . t("If you need more room, move a field close to the bottom.  The\n          container will resize, adding more room.") . "</div>";
  $rtn .= arrange_fields_render_dialogs();
  return $rtn;
}