Same name and namespace in other branches
- 7.x includes/form.inc \form_get_cache()
Fetch a form from cache.
Related topics
1 call to form_get_cache()
- poll_choice_js in modules/
poll/ poll.module - Menu callback for AHAH additions.
File
- includes/
form.inc, line 253
Code
function form_get_cache($form_build_id, &$form_state) {
global $user;
if ($cached = cache_get('form_' . $form_build_id, 'cache_form')) {
$form = $cached->data;
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;
}
// Generate a new #build_id if the cached form was rendered on a cacheable
// page.
if (!empty($form['#immutable'])) {
$form['#build_id'] = 'form-' . drupal_random_key();
$form['form_build_id']['#value'] = $form['#build_id'];
$form['form_build_id']['#id'] = $form['#build_id'];
unset($form['#immutable']);
form_build_id_map($form_build_id, $form['#build_id']);
}
return $form;
}
}
}