You are here

public function SimplesamlphpCustomAttributesDeleteForm::submitForm in SimpleSAMLphp Custom Attribute Mapping 8

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/SimplesamlphpCustomAttributesDeleteForm.php, line 120

Class

SimplesamlphpCustomAttributesDeleteForm

Namespace

Drupal\simplesamlphp_custom_attributes\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $mappings = $this->mappingConfig
    ->get('mappings');

  // Remove the mapping from the array.
  unset($mappings[$form_state
    ->get('simplesamlphp_custom_attributes_mapping')]);

  // Save the new config.
  $this->mappingConfig
    ->set('mappings', $mappings)
    ->save();

  // Go back to the list page.
  $form_state
    ->setRedirect('simplesamlphp_custom_attributes.list');
}