You are here

public function DataPolicyRevisionDeleteForm::submitForm in Data Policy 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

src/Form/DataPolicyRevisionDeleteForm.php, line 117

Class

DataPolicyRevisionDeleteForm
Provides a form for deleting a Data policy revision.

Namespace

Drupal\data_policy\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->dataPolicyStorage
    ->deleteRevision($this->revision
    ->getRevisionId());
  $this
    ->logger('content')
    ->notice('Data policy: deleted revision %revision.', [
    '%revision' => $this->revision
      ->getRevisionId(),
  ]);
  $this
    ->messenger()
    ->addStatus($this
    ->t('Revision from %revision-date has been deleted.', [
    '%revision-date' => $this->dateFormatter
      ->format($this->revision
      ->getRevisionCreationTime()),
  ]));
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
}