You are here

public function LibraryItemRevisionDeleteForm::submitForm in Paragraphs 8

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

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

Overrides FormInterface::submitForm

File

modules/paragraphs_library/src/Form/LibraryItemRevisionDeleteForm.php, line 89

Class

LibraryItemRevisionDeleteForm

Namespace

Drupal\paragraphs_library\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->entityTypeManager
    ->getStorage('paragraphs_library_item')
    ->deleteRevision($this->revision
    ->getRevisionId());
  $this->messenger
    ->addMessage($this
    ->t('Revision from %revision-date has been deleted.', [
    '%revision-date' => $this->dateFormatter
      ->format($this->revision
      ->getChangedTime()),
  ]));
  $form_state
    ->setRedirect('entity.paragraphs_library_item.version_history', [
    'paragraphs_library_item' => $this->revision
      ->id(),
  ]);
}