You are here

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

Same name and namespace in other branches
  1. 8.4 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 621

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) {
  $drupalAcctProvisionServer = $form_state
    ->getValue('drupalAcctProvisionServer') == 'none' ? NULL : $form_state
    ->getValue('drupalAcctProvisionServer');
  $ldapEntryProvisionServer = $form_state
    ->getValue('ldapEntryProvisionServer') == 'none' ? NULL : $form_state
    ->getValue('ldapEntryProvisionServer');
  $processedSyncMappings[self::PROVISION_TO_DRUPAL] = $this
    ->syncMappingsFromForm($form_state
    ->getValues(), self::PROVISION_TO_DRUPAL);
  $processedSyncMappings[self::PROVISION_TO_LDAP] = $this
    ->syncMappingsFromForm($form_state
    ->getValues(), self::PROVISION_TO_LDAP);
  $this
    ->config('ldap_user.settings')
    ->set('drupalAcctProvisionServer', $drupalAcctProvisionServer)
    ->set('ldapEntryProvisionServer', $ldapEntryProvisionServer)
    ->set('drupalAcctProvisionTriggers', $form_state
    ->getValue('drupalAcctProvisionTriggers'))
    ->set('ldapEntryProvisionTriggers', $form_state
    ->getValue('ldapEntryProvisionTriggers'))
    ->set('userUpdateCronQuery', $form_state
    ->getValue('userUpdateCronQuery'))
    ->set('userUpdateCronInterval', $form_state
    ->getValue('userUpdateCronInterval'))
    ->set('orphanedDrupalAcctBehavior', $form_state
    ->getValue('orphanedDrupalAcctBehavior'))
    ->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'))
    ->set('ldapUserSyncMappings', $processedSyncMappings)
    ->save();
  $form_state
    ->getValues();
  SemaphoreStorage::flushAllValues();
  $this->cache
    ->invalidate('ldap_user_sync_mapping');
  drupal_set_message($this
    ->t('User synchronization configuration updated.'));
}