You are here

function simple_ldap_user_translate_term_drupal_to_ldap in Simple LDAP 7.2

1 string reference to 'simple_ldap_user_translate_term_drupal_to_ldap'
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 157

Code

function simple_ldap_user_translate_term_drupal_to_ldap(&$value, $field_info, $items) {
  if (is_array($items)) {
    $tids = array();

    // Collect the TIDs.
    foreach ($items as $item) {
      $tids = array_merge($tids, array_values($item));
    }

    // Load the terms by TID
    $terms = taxonomy_term_load_multiple($tids);

    // Save the term.
    foreach ($terms as $term) {
      $value[] = $term->name;
    }
  }
}