You are here

public function ProfileForm::editCancelSubmit in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/src/ProfileForm.php \Drupal\user\ProfileForm::editCancelSubmit()

Provides a submit handler for the 'Cancel account' button.

File

core/modules/user/src/ProfileForm.php, line 60
Contains \Drupal\user\ProfileForm.

Class

ProfileForm
Form controller for the profile forms.

Namespace

Drupal\user

Code

public function editCancelSubmit($form, FormStateInterface $form_state) {
  $destination = array();
  $query = $this
    ->getRequest()->query;
  if ($query
    ->has('destination')) {
    $destination = array(
      'destination' => $query
        ->get('destination'),
    );
    $query
      ->remove('destination');
  }

  // We redirect from user/%/edit to user/%/cancel to make the tabs disappear.
  $form_state
    ->setRedirect('entity.user.cancel_form', array(
    'user' => $this->entity
      ->id(),
  ), array(
    'query' => $destination,
  ));
}