function ProfileForm::editCancelSubmit
Provides a submit handler for the 'Cancel account' button.
File
-
core/
modules/ user/ src/ ProfileForm.php, line 45
Class
- ProfileForm
- Form handler for the profile forms.
Namespace
Drupal\userCode
public function editCancelSubmit($form, FormStateInterface $form_state) {
$destination = [];
$query = $this->getRequest()->query;
if ($query->has('destination')) {
$destination = [
'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', [
'user' => $this->entity
->id(),
], [
'query' => $destination,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.