public function SamlauthMappingDeleteForm::buildForm in SAML Authentication 4.x
Same name and namespace in other branches
- 8.3 modules/samlauth_user_fields/src/Form/SamlauthMappingDeleteForm.php \Drupal\samlauth_user_fields\Form\SamlauthMappingDeleteForm::buildForm()
Form for deleting a mapping.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
int $mapping_id: (optional) The numeric ID of the mapping.
Return value
array The form structure.
Overrides ConfirmFormBase::buildForm
File
- modules/
samlauth_user_fields/ src/ Form/ SamlauthMappingDeleteForm.php, line 77
Class
- SamlauthMappingDeleteForm
- Form for deleting a mapping.
Namespace
Drupal\samlauth_user_fields\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $mapping_id = NULL) {
if ($mapping_id !== NULL) {
$mappings = $this
->configFactory()
->get(UserFieldsEventSubscriber::CONFIG_OBJECT_NAME)
->get('field_mappings');
// Set these values for the confirm message to pick up on them.
$this->attributeName = $mappings[$mapping_id]['attribute_name'];
$this->fieldName = $mappings[$mapping_id]['field_name'];
// Set the mapping id so the submit handler can delete it.
$form_state
->set('mapping_id', $mapping_id);
return parent::buildForm($form, $form_state);
}
return [];
}