You are here

public function AutosaveEntityFormHandler::formAlter in Autosave Form 8

Performs the needed alterations to the entity form.

Parameters

array $form: The entity form to be altered to provide the autosave functionality.

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

Overrides AutosaveFormInterface::formAlter

File

src/Form/AutosaveEntityFormHandler.php, line 170

Class

AutosaveEntityFormHandler
Base class for autosave form handlers.

Namespace

Drupal\autosave_form\Form

Code

public function formAlter(array &$form, FormStateInterface $form_state) {
  $this
    ->traitFormAlter($form, $form_state);

  // Flag the entity with the current autosave session ID.
  $form['#entity_builders'][] = [
    static::class,
    'entityFormEntityBuild',
  ];
}