You are here

function i18nsync_node_taxonomy in Internationalization 6

Same name and namespace in other branches
  1. 5.3 experimental/i18nsync.module \i18nsync_node_taxonomy()
  2. 5 experimental/i18nsync.module \i18nsync_node_taxonomy()
  3. 5.2 experimental/i18nsync.module \i18nsync_node_taxonomy()

Synchronize taxonomy.

Translate translatable terms, just copy over the rest.

1 call to i18nsync_node_taxonomy()
i18nsync_node_translation in i18nsync/i18nsync.module
Synchronizes fields for node translation.

File

i18nsync/i18nsync.module, line 346
Internationalization (i18n) package. Synchronization of translations

Code

function i18nsync_node_taxonomy(&$node, &$source) {
  if (module_exists('i18ntaxonomy') && is_array($source->taxonomy)) {

    // Load clean source node taxonomy so we don't need to handle weird form input
    if (!isset($source->i18ntaxonomy)) {
      $source->i18ntaxonomy = i18ntaxonomy_node_get_terms($source);
    }
    $node->taxonomy = i18ntaxonomy_translate_terms($source->i18ntaxonomy, $node->language, FALSE);
  }
  else {

    // If not multilingual taxonomy enabled, just copy over.
    $node->taxonomy = $source->taxonomy;
  }
}