You are here

public function LdapUserAdminForm::submitForm in Lightweight Directory Access Protocol (LDAP) 8.4

Same name and namespace in other branches
  1. 8.3 ldap_user/src/Form/LdapUserAdminForm.php \Drupal\ldap_user\Form\LdapUserAdminForm::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 ConfigFormBase::submitForm

File

ldap_user/src/Form/LdapUserAdminForm.php, line 376

Class

LdapUserAdminForm
Provides the form to configure user configuration and field mapping.

Namespace

Drupal\ldap_user\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) : void {
  $drupalAcctProvisionServer = $form_state
    ->getValue('drupalAcctProvisionServer') === 'none' ? NULL : $form_state
    ->getValue('drupalAcctProvisionServer');
  $ldapEntryProvisionServer = $form_state
    ->getValue('ldapEntryProvisionServer') === 'none' ? NULL : $form_state
    ->getValue('ldapEntryProvisionServer');
  $this
    ->config('ldap_user.settings')
    ->set('drupalAcctProvisionServer', $drupalAcctProvisionServer)
    ->set('ldapEntryProvisionServer', $ldapEntryProvisionServer)
    ->set('drupalAcctProvisionTriggers', $this
    ->reduceTriggerList($form_state
    ->getValue('drupalAcctProvisionTriggers')))
    ->set('ldapEntryProvisionTriggers', $this
    ->reduceTriggerList($form_state
    ->getValue('ldapEntryProvisionTriggers')))
    ->set('userUpdateCronQuery', $form_state
    ->getValue('userUpdateCronQuery'))
    ->set('userUpdateCronInterval', $form_state
    ->getValue('userUpdateCronInterval'))
    ->set('orphanedDrupalAcctBehavior', $form_state
    ->getValue('orphanedDrupalAcctBehavior'))
    ->set('orphanedDrupalAcctReportingInbox', $form_state
    ->getValue('orphanedDrupalAcctReportingInbox'))
    ->set('orphanedCheckQty', $form_state
    ->getValue('orphanedCheckQty'))
    ->set('orphanedAccountCheckInterval', $form_state
    ->getValue('orphanedAccountCheckInterval'))
    ->set('userConflictResolve', $form_state
    ->getValue('userConflictResolve'))
    ->set('manualAccountConflict', $form_state
    ->getValue('manualAccountConflict'))
    ->set('acctCreation', $form_state
    ->getValue('acctCreation'))
    ->set('disableAdminPasswordField', $form_state
    ->getValue('disableAdminPasswordField'))
    ->save();
  $form_state
    ->getValues();
  $this
    ->messenger()
    ->addMessage($this
    ->t('User synchronization configuration updated.'));
}