You are here

private function FieldProvider::addUserEntityFields in Lightweight Directory Access Protocol (LDAP) 8.4

Add user entity fields.

1 call to FieldProvider::addUserEntityFields()
FieldProvider::loadAttributes in ldap_user/src/FieldProvider.php
LDAP attributes to alter.

File

ldap_user/src/FieldProvider.php, line 415

Class

FieldProvider
Provides the basic and required fields needed for user mappings.

Namespace

Drupal\ldap_user

Code

private function addUserEntityFields() : void {

  // Drupal user properties.
  $this->attributes['[property.status]'] = new Mapping('[property.status]', 'Property: Account Status', TRUE, FALSE, [], 'ldap_user', 'ldap_user');
  $this->attributes['[property.timezone]'] = new Mapping('[property.timezone]', 'Property: User Timezone', TRUE, FALSE, [], 'ldap_user', 'ldap_user');
  $this->attributes['[property.signature]'] = new Mapping('[property.signature]', 'Property: User Signature', TRUE, FALSE, [], 'ldap_user', 'ldap_user');

  // Load the remaining active unmanaged Drupal fields.
  // @todo Consider not hard-coding the other properties.
  $user_fields = $this->entityFieldManager
    ->getFieldStorageDefinitions('user');
  foreach ($user_fields as $field_name => $field_instance) {
    $field_id = sprintf('[field.%s]', $field_name);
    if (!isset($this->attributes[$field_id])) {
      $this->attributes[$field_id] = new Mapping($field_id, (string) $this
        ->t('Field: @label', [
        '@label' => $field_instance
          ->getLabel(),
      ]), TRUE, FALSE, [], 'ldap_user', 'ldap_user');
    }
  }
}