function arrange_fields_display_form in Arrange Fields 7
Same name and namespace in other branches
- 6 arrange_fields.module \arrange_fields_display_form()
This function will display a form and let us arrange its fields. It is designed to work with Drupal's content types (not Webform or programmer-designed forms).
1 string reference to 'arrange_fields_display_form'
- arrange_fields_menu in ./
arrange_fields.module - Implementation of hook_menu()
File
- ./
arrange_fields.module, line 581
Code
function arrange_fields_display_form($form_type) {
if (is_object($form_type)) {
// Figure out some information about the form.
$form_type_name = $form_type->name;
$form_type = $form_type->type;
}
else {
$form_type_name = $form_type;
}
//drupal_set_title("Arrange fields - $form_type_name");
$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.
$temp_form = drupal_get_form("arrange_fields_position_form", $form_id, $form_type);
$rtn .= drupal_render($temp_form);
$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->language = "";
// set here just to keep it from throwing a notice.
$node_form->type = $form_type;
$temp_form = drupal_get_form($form_id, $node_form);
$rtn .= drupal_render($temp_form);
$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;
}