You are here

function autosave_get_autosaved_form in Autosave 7

Same name and namespace in other branches
  1. 5.3 autosave.module \autosave_get_autosaved_form()
  2. 5 autosave.module \autosave_get_autosaved_form()
  3. 5.2 autosave.module \autosave_get_autosaved_form()
  4. 6.2 autosave.module \autosave_get_autosaved_form()
  5. 6 autosave.module \autosave_get_autosaved_form()
  6. 7.2 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 $path: The the internal Drupal path where the form is located

string $uid: Drupal UID of the user

Return value

An array containing the serialized values of the autosaved form and the timestamp of when the form was autosaved.

1 call to autosave_get_autosaved_form()
autosave_form_alter in ./autosave.module
Implements hook_form_alter(). ().

File

./autosave.module, line 192
Does background saves of node being edited.

Code

function autosave_get_autosaved_form($form_id, $path, $uid) {
  $result = db_query("SELECT form_id, serialized, timestamp FROM {autosaved_forms} WHERE form_id = :form_id AND path = :path AND uid = :uid", array(
    ':form_id' => $form_id,
    ':path' => $path,
    ':uid' => $uid,
  ));
  $form = FALSE;
  foreach ($result as $data) {
    $form['serialized'] = $data->serialized;
    $form['timestamp'] = $data->timestamp;
  }
  return $form;
}