public function AuthmapDeleteForm::submitForm in External Authentication 2.0.x
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/ AuthmapDeleteForm.php, line 130
Class
- AuthmapDeleteForm
- Confirm the user wants to delete an authmap entry.
Namespace
Drupal\externalauth\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$provider = $this
->getRouteMatch()
->getParameter('provider');
$uid = $this
->getRouteMatch()
->getParameter('uid');
if (!$provider || !$uid || filter_var($uid, FILTER_VALIDATE_INT) === FALSE) {
throw new \LogicException('It should be impossible to submit this form without valid provider/uid parameters.');
}
$this->connection
->delete('authmap')
->condition('uid', (int) $uid)
->condition('provider', $provider)
->execute();
$this
->messenger()
->addStatus($this
->t('The link has been deleted.'));
$form_state
->setRedirectUrl($this
->getCancelUrl());
}