You are here

private function LdapUserMappingBaseForm::sanitizeMachineName in Lightweight Directory Access Protocol (LDAP) 8.4

Sanitize machine name.

Parameters

string $string: Field name.

Return value

string Machine name.

File

ldap_user/src/Form/LdapUserMappingBaseForm.php, line 254

Class

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

Namespace

Drupal\ldap_user\Form

Code

private function sanitizeMachineName(string $string) : string {

  // Replace periods & square brackets.
  return str_replace([
    '.',
    '[',
    ']',
  ], [
    '-',
    '',
    '',
  ], $string);
}