You are here

public function AutosaveEntityFormHandler::getLastAutosavedFormState in Autosave Form 8

Retrieves the last autosaved form state if any present.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form, based on which to retrieve the last autosaved form state.

string $autosave_form_session_id: The autosave form session ID for which to retrieve the form state.

string|int $uid: The user id.

Return value

\Drupal\Core\Form\FormStateInterface|NULL The last autosaved form state or NULL if none present.

Overrides AutosaveFormInterface::getLastAutosavedFormState

File

src/Form/AutosaveEntityFormHandler.php, line 254

Class

AutosaveEntityFormHandler
Base class for autosave form handlers.

Namespace

Drupal\autosave_form\Form

Code

public function getLastAutosavedFormState(FormStateInterface $form_state, $autosave_form_session_id, $uid) {
  list($form_id, $entity) = $this
    ->getFormIDandEntity($form_state);
  return $this->autosaveEntityFormStorage
    ->getFormState($form_id, $entity
    ->getEntityTypeId(), $entity
    ->id(), $entity
    ->language()
    ->getId(), $uid, $autosave_form_session_id);
}