You are here

public function AutosaveEntityFormHandler::getLastAutosavedTimestamp in Autosave Form 8

Retrieves the last autosaved timestamp.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

string|int $uid: The user id.

Return value

int The last autosaved timestamp.

Overrides AutosaveFormInterface::getLastAutosavedTimestamp

File

src/Form/AutosaveEntityFormHandler.php, line 270

Class

AutosaveEntityFormHandler
Base class for autosave form handlers.

Namespace

Drupal\autosave_form\Form

Code

public function getLastAutosavedTimestamp(FormStateInterface $form_state, $uid) {
  list($form_id, $entity) = $this
    ->getFormIDandEntity($form_state);
  return $entity
    ->isNew() ? NULL : $this->autosaveEntityFormStorage
    ->getLastAutosavedStateTimestamp($form_id, $entity
    ->getEntityTypeId(), $entity
    ->id(), $entity
    ->language()
    ->getId(), $uid);
}