form_get_cache

Definition

form_get_cache($form_build_id, &$form_state)
drupal/includes/form.inc, line 220

Description

Fetch a form from cache.

Related topics

Namesort iconDescription
Form generationFunctions to enable the processing and display of HTML forms.

Code

function form_get_cache($form_build_id, &$form_state) {
  if ($cached = cache_get('form_' . $form_build_id, 'cache_form')) {
    $form = $cached->data;
    global $user;
    if ((isset($form['#cache_token']) && drupal_valid_token($form['#cache_token'])) || (!isset($form['#cache_token']) && !$user->uid)) {
      if ($cached = cache_get('storage_' . $form_build_id, 'cache_form')) {
        $form_state['storage'] = $cached->data;
      }
      return $form;
    }
  }
}