function simple_ldap_user_translate_term_ldap_to_drupal in Simple LDAP 7.2
Map the value(s) in the LDAP attr to one or more TIDs. This will *NOT* create new Terms if they are not present, and this funciton does not understand the term's heirarchy. If the term's name is ambiguous, the one selected depends on the order the database returns them.
1 string reference to 'simple_ldap_user_translate_term_ldap_to_drupal'
- simple_ldap_user_simple_ldap_data_handlers in simple_ldap_user/
simple_ldap_user.module - Implements HOOK_simple_ldap_data_handlers()
File
- simple_ldap_user/
simple_ldap_user.ldap_handlers.inc, line 130
Code
function simple_ldap_user_translate_term_ldap_to_drupal(&$edit, $info, $items, $ldap_attr, $language) {
$tids = array();
$count = $ldap_attr['count'];
unset($ldap_attr['count']);
// Collect the TIDs that match the terms in the LDAP field
// Limit the search to valid vocabularies this field may use.
for ($i = 0; $i < $count; $i++) {
$tids = simple_ldap_user_find_tids_by_terms($info, $ldap_attr);
}
// Don't save if the existing list matches the LDAP list
if ($items == $tids || count($items) == count($tids)) {
$local_tids = array_map('_simple_ldap_user_tid_value', empty($items) ? array() : $items);
$ldap_tids = array_map('_simple_ldap_user_tid_value', empty($tids) ? array() : $tids);
sort($local_tids);
sort($ldap_tids);
if ($local_tids === $ldap_tids) {
return;
}
}
$edit[$info['field_name']][$language] = $tids;
}