function arrange_fields_display_webform in Arrange Fields 7
Same name and namespace in other branches
- 6 arrange_fields.module \arrange_fields_display_webform()
Similar function as arrange_fields_display_form, but this is specifically for webforms (with the webform module).
1 string reference to 'arrange_fields_display_webform'
- arrange_fields_menu in ./
arrange_fields.module - Implementation of hook_menu()
File
- ./
arrange_fields.module, line 645
Code
function arrange_fields_display_webform($nid) {
if (is_object($nid)) {
// We were passed a node by the menu, so sort out
// what is supposed to be the node, and what the nid.
$webform_node = $nid;
$nid = $webform_node->nid;
}
else {
$webform_node = node_load($nid);
}
$form_id = "webform_client_form_{$nid}";
$form_type = "webform";
//if (drupal_set_title() == "") {
// drupal_set_title("Arrange fields - Webform - $webform_node->title");
//}
$rtn = "";
$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 webform entry 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;
$temp_form = drupal_get_form($form_id, $webform_node, NULL, TRUE);
$rtn .= drupal_render($temp_form);
$rtn .= "<div>" . t("If you need more room, move a field close to the bottom, then save positions. The\n container will resize, adding more room.") . "</div>";
$rtn .= arrange_fields_render_dialogs();
return $rtn;
}