You are here

public static function AutosaveEntityFormHandler::entityFormEntityBuild in Autosave Form 8

Entity builder method.

Flags the entity with the autosave form session ID.

Parameters

string $entity_type: The type of the entity.

\Drupal\Core\Entity\EntityInterface $entity: The entity whose form is being built.

File

src/Form/AutosaveEntityFormHandler.php, line 220

Class

AutosaveEntityFormHandler
Base class for autosave form handlers.

Namespace

Drupal\autosave_form\Form

Code

public static function entityFormEntityBuild($entity_type, EntityInterface $entity, array $form, FormStateInterface $form_state) {
  if ($autosave_form_session_id = static::getAutosaveFormSessionID($form_state)) {
    $entity->{static::AUTOSAVE_SESSION_ID} = $autosave_form_session_id;
  }
}