drupal_process_form
includes/form.inc, строка 238
- Версии
- 5
drupal_process_form($form_id, &$form)
- 6
drupal_process_form($form_id, &$form, &$form_state)
This function is the heart of form API. The form gets built, validated and in appropriate cases, submitted.
Параметры
$form_id
The unique string identifying the current form.
$form
Ассоциативный массив, содержащий структуру формы
Возвращаемое значение
The path to redirect the user to upon completion.
Связанные темы
Код
<?php
function drupal_process_form($form_id, &$form) {
global $form_values, $form_submitted, $user, $form_button_counter;
static $saved_globals = array();
// In some scenarios, this function can be called recursively. Pushing any pre-existing
// $form_values and form submission data lets us start fresh without clobbering work done
// in earlier recursive calls.
array_push($saved_globals, array($form_values, $form_submitted, $form_button_counter));
$form_values = array();
$form_submitted = FALSE;
$form_button_counter = array(0, 0);
drupal_prepare_form($form_id, $form);
if (($form['#programmed']) || (!empty($_POST) && (($_POST['form_id'] == $form_id)))) {
drupal_validate_form($form_id, $form);
// IE does not send a button value when there is only one submit button (and no non-submit buttons)
// and you submit by pressing enter.
// In that case we accept a submission without button values.
if ((($form['#programmed']) || $form_submitted || (!$form_button_counter[0] && $form_button_counter[1])) && !form_get_errors()) {
$redirect = drupal_submit_form($form_id, $form);
if (!$form['#programmed']) {
drupal_redirect_form($form, $redirect);
}
}
}
// We've finished calling functions that alter the global values, so we can
// restore the ones that were there before this function was called.
list($form_values, $form_submitted, $form_button_counter) = array_pop($saved_globals);
return $redirect;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии