You are here

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

Same name and namespace in other branches
  1. 8.3 ldap_authentication/src/Form/LdapAuthenticationAdminForm.php \Drupal\ldap_authentication\Form\LdapAuthenticationAdminForm::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_authentication/src/Form/LdapAuthenticationAdminForm.php, line 367

Class

LdapAuthenticationAdminForm
Provides the form for ldap_authentication options.

Namespace

Drupal\ldap_authentication\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) : void {

  // Add form data to object and save or create.
  $values = $form_state
    ->getValues();
  $this
    ->config('ldap_authentication.settings')
    ->set('authenticationMode', $values['authenticationMode'])
    ->set('skipAdministrators', $values['skipAdministrators'])
    ->set('sids', $values['authenticationServers'])
    ->set('allowOnlyIfTextInDn', self::linesToArray($values['allowOnlyIfTextInDn']))
    ->set('excludeIfTextInDn', self::linesToArray($values['excludeIfTextInDn']))
    ->set('loginUIUsernameTxt', $values['loginUIUsernameTxt'])
    ->set('loginUIPasswordTxt', $values['loginUIPasswordTxt'])
    ->set('ldapUserHelpLinkUrl', $values['ldapUserHelpLinkUrl'])
    ->set('ldapUserHelpLinkText', $values['ldapUserHelpLinkText'])
    ->set('excludeIfNoAuthorizations', $values['excludeIfNoAuthorizations'])
    ->set('emailOption', $values['emailOption'])
    ->set('emailUpdate', $values['emailUpdate'])
    ->set('emailTemplateHandling', $values['emailTemplateHandling'])
    ->set('emailTemplate', $values['emailTemplate'])
    ->set('emailTemplateUsageResolveConflict', $values['templateUsageResolveConflict'])
    ->set('emailTemplateUsageNeverUpdate', $values['templateUsageNeverUpdate'])
    ->set('emailTemplateUsagePromptUser', $values['templateUsagePromptUser'])
    ->set('emailTemplateUsageRedirectOnLogin', $values['templateUsageRedirectOnLogin'])
    ->set('emailTemplateUsagePromptRegex', $values['templateUsagePromptRegex'])
    ->set('passwordOption', $values['passwordOption'])
    ->save();
  $this
    ->messenger()
    ->addMessage($this
    ->t('Settings updated.'));
}