You are here

function simple_ldap_user_translate_ldap_attr_to_drupal in Simple LDAP 7.2

Translate a single LDAP Attribute to the mapped Drupal user entity field.

1 call to simple_ldap_user_translate_ldap_attr_to_drupal()
simple_ldap_user_generate_edit_ldap_to_drupal in simple_ldap_user/simple_ldap_user.module

File

simple_ldap_user/simple_ldap_user.module, line 825
Main simple_ldap_user module file.

Code

function simple_ldap_user_translate_ldap_attr_to_drupal(&$edit, $account, $ldap_attr_data, $drupal_field) {
  $items = field_get_items('user', $account, $drupal_field);
  $info = field_info_field($drupal_field);
  $language = field_language('user', $account, $drupal_field);
  $handlers = simple_ldap_user_get_data_handlers();
  $field_type = $info['type'];
  $handler = array_key_exists($field_type, $handlers) ? $handlers[$field_type] : $handlers['#default'];
  if (!empty($handler['file'])) {
    require_once $handler['file'];
  }
  $handler['import_callback']($edit, $info, $items, $ldap_attr_data, $language);
}