You are here

public function SamlauthMappingDeleteForm::submitForm in SAML Authentication 8.3

Same name and namespace in other branches
  1. 4.x modules/samlauth_user_fields/src/Form/SamlauthMappingDeleteForm.php \Drupal\samlauth_user_fields\Form\SamlauthMappingDeleteForm::submitForm()

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

modules/samlauth_user_fields/src/Form/SamlauthMappingDeleteForm.php, line 116

Class

SamlauthMappingDeleteForm
Form for deleting a mapping.

Namespace

Drupal\samlauth_user_fields\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->configFactory()
    ->getEditable(UserFieldsEventSubscriber::CONFIG_OBJECT_NAME);
  $mappings = $config
    ->get('field_mappings');
  unset($mappings[$form_state
    ->get('mapping_id')]);
  $config
    ->set('field_mappings', $mappings)
    ->save();
  $form_state
    ->setRedirect('samlauth_user_fields.list');
}