function drupal_rebuild_form_new

Views' replacement of drupal_rebuild_form.

This change merely respects a form's wishes not to be cached.

1 call to drupal_rebuild_form_new()
_drupal_build_form in includes/form.inc
@file form.inc Views' replacements for Drupal's form functions.

File

includes/form.inc, line 113

Code

function drupal_rebuild_form_new($form_id, &$form_state, $args, $form_build_id = NULL) {
    // Remove the first argument. This is $form_id.when called from
    // drupal_get_form and the original $form_state when called from some AHAH
    // callback. Neither is needed. After that, put in the current state.
    $args[0] =& $form_state;
    // And the form_id.
    array_unshift($args, $form_id);
    $form = call_user_func_array('drupal_retrieve_form', $args);
    if (!isset($form_build_id)) {
        // We need a new build_id for the new version of the form.
        $form_build_id = 'form-' . md5(mt_rand());
    }
    $form['#build_id'] = $form_build_id;
    drupal_prepare_form($form_id, $form, $form_state);
    if (empty($form['#no_cache'])) {
        // Now, we cache the form structure so it can be retrieved later for
        // validation. If $form_state['storage'] is populated, we'll also cache
        // it so that it can be used to resume complex multi-step processes.
        form_set_cache($form_build_id, $form, $form_state);
    }
    // Originally this called drupal_process_form, but all that happens there
    // is form_builder and then submission; and the rebuilt form is not
    // allowed to submit. Therefore, just do this:
    $form['#post'] = $form_state['input'];
    $form = form_builder($form_id, $form, $form_state);
    return $form;
}