function autosave_get_autosaved_form in Autosave 7.2
Same name and namespace in other branches
- 5.3 autosave.module \autosave_get_autosaved_form()
- 5 autosave.module \autosave_get_autosaved_form()
- 5.2 autosave.module \autosave_get_autosaved_form()
- 6.2 autosave.module \autosave_get_autosaved_form()
- 6 autosave.module \autosave_get_autosaved_form()
- 7 autosave.module \autosave_get_autosaved_form()
Get the autosaved form at a particular path for a user.
Parameters
string $form_id: The form_id of the form.
string $formid: The ID of the form to reload. This should be in Javascript format, vis, using - instead of _.
int $timestamp: The timestamp at which the autosaved form was saved. This is used to differentiate between different people mucking with the same form.
Return value
An array containing the serialized values of the autosaved form and the timestamp of when the form was autosaved.
2 calls to autosave_get_autosaved_form()
- autosave_restore in ./
autosave.module - Menu callback; AHAH return the form, repopulated with autosaved data.
- autosave_restore_access in ./
autosave.module - Access callback for the form restore menu callback.
File
- ./
autosave.module, line 457 - Does background saves of node being edited.
Code
function autosave_get_autosaved_form($form_id, $timestamp, $uid) {
static $forms = array();
if (empty($forms[$form_id][$timestamp])) {
// Fetch the saved form, if any.
$forms[$form_id][$timestamp] = db_query("SELECT form_id, serialized, path, timestamp, args FROM {autosaved_forms} WHERE form_id = :form_id AND timestamp = :timestamp AND uid = :uid", array(
':form_id' => str_replace('-', '_', $form_id),
':timestamp' => $timestamp,
':uid' => $uid,
))
->fetchObject();
}
return $forms[$form_id][$timestamp];
}