You are here

function arrange_fields_position_form_validate in Arrange Fields 6

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

The primary purpose of this validator is to find out of the user is trying to reset the form (and restore the form to its orignal state).

File

./arrange_fields.module, line 1346

Code

function arrange_fields_position_form_validate($form, &$form_state) {
  $form_id = $form_state["values"]["arrange_fields_form_id"];
  if (stristr($form_state["values"]["op"], "reset")) {
    variable_set("arrange_fields_position_data_{$form_id}", "");
    drupal_set_message(t("Position data for this form has been reset.  It will \n                      be displayed to the user without any modifications,\n                      in its original state."));

    // Need to refresh the page in order for the positions to be
    // fully reset.  This next bit finds out what the current URL is,
    // then sends the user there again (refreshing the page)
    $path = isset($_GET['q']) ? $_GET['q'] : '<front>';
    $link = url($path, array(
      'absolute' => TRUE,
    ));
    drupal_goto($link);
  }

  // This bit is required in order to let javascript submit the form!
  // (Which happens after you change CCK settings in the popup, then
  // click the button which says it is going to save and reload your form).
  $form_state["submitted"] = TRUE;
}