function arrange_fields_display_otherform in Arrange Fields 7
Same name and namespace in other branches
- 6 arrange_fields.module \arrange_fields_display_otherform()
Similar function as arrange_fields_display_form, but this is specifically for other, more generic forms on the system. For example, user_register, or custom forms which a developer has written.
1 string reference to 'arrange_fields_display_otherform'
- arrange_fields_menu in ./
arrange_fields.module - Implementation of hook_menu()
File
- ./
arrange_fields.module, line 713
Code
function arrange_fields_display_otherform($form_id) {
$form_type = "otherform";
// If the form_id has a : in it, it means the user has also specified
// include files they want included.
// Expected to look a little like this:
// form_id : module , include.file
// ex: contact_site_form : contact, contact.pages.inc
if (strstr($form_id, ":")) {
$temp = explode(":", $form_id);
$form_id = trim($temp[0]);
$include_data = explode(",", $temp[1]);
$include_module = trim($include_data[0]);
$include_file = trim($include_data[1]);
// Okay, still not done. The include file looks something like this:
// contact.pages.inc
// We need to separate the extension off of it.
$temp = explode(".", $include_file);
$include_ext = trim($temp[count($temp) - 1]);
$include_file = trim(str_replace(".{$include_ext}", "", $include_file));
// Okay, we FINALLY have enough information to include the file! Let's give it a try!
module_load_include($include_ext, $include_module, $include_file);
}
drupal_set_title("Arrange fields - Other Forms - {$form_id}");
$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 form 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);
$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;
}