ProfileForm::editCancelSubmit

public ProfileForm::editCancelSubmit($form, FormStateInterface $form_state)

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

File

core/modules/user/src/ProfileForm.php, line 55

Class

ProfileForm
Form handler 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)
  );
}
doc_Drupal
2016-10-29 09:35:04
Comments
Leave a Comment

Please login to continue.