You are here

protected function AutosaveEntityFormHandler::getFormIDandEntity in Autosave Form 8

Retrieves the form ID and the form entity object from the form state.

Parameters

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

Return value

array The first value is the form ID and the second the form entity object.

7 calls to AutosaveEntityFormHandler::getFormIDandEntity()
AutosaveEntityFormHandler::getLastAutosavedFormState in src/Form/AutosaveEntityFormHandler.php
Retrieves the last autosaved form state if any present.
AutosaveEntityFormHandler::getLastAutosavedTimestamp in src/Form/AutosaveEntityFormHandler.php
Retrieves the last autosaved timestamp.
AutosaveEntityFormHandler::isAutosaveEnabled in src/Form/AutosaveEntityFormHandler.php
Determines if autosave is enabled for the current form.
AutosaveEntityFormHandler::isAutosaveSubmitValid in src/Form/AutosaveEntityFormHandler.php
Checks if the autosave submit is allowed.
AutosaveEntityFormHandler::purgeAllAutosavedStates in src/Form/AutosaveEntityFormHandler.php
Purges all autosaved state sessions for the current form and user.

... See full list

File

src/Form/AutosaveEntityFormHandler.php, line 321

Class

AutosaveEntityFormHandler
Base class for autosave form handlers.

Namespace

Drupal\autosave_form\Form

Code

protected function getFormIDandEntity(FormStateInterface $form_state) {

  /** @var EntityFormInterface $form_object */
  $form_object = $form_state
    ->getFormObject();
  $form_id = $form_object
    ->getFormId();
  $entity = $form_object
    ->getEntity();
  return [
    $form_id,
    $entity,
  ];
}