You are here

public function BrowserGroupsForm::cancel in Paragraphs Browser 8

Cancels the editing of the index's fields.

Parameters

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

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

File

src/Form/BrowserGroupsForm.php, line 222
Contains \Drupal\paragraphs_browser\Form\BrowserGroupsForm.

Class

BrowserGroupsForm
Class CleanupUrlAliases.

Namespace

Drupal\paragraphs_browser\Form

Code

public function cancel(array &$form, FormStateInterface $form_state) {
  if ($this->entity instanceof UnsavedConfigurationInterface && $this->entity
    ->hasChanges()) {
    $this->entity
      ->discardChanges();
  }
  $form_state
    ->setRedirectUrl($this->entity
    ->toUrl('canonical'));
}