You are here

function globallink_get_taxonomy_xml_for_I18N_MODE_LOCALIZE in GlobalLink Connect for Drupal 7.5

Same name and namespace in other branches
  1. 7.7 globallink_taxonomy/globallink_taxonomy.inc \globallink_get_taxonomy_xml_for_I18N_MODE_LOCALIZE()
  2. 7.6 globallink_taxonomy/globallink_taxonomy.inc \globallink_get_taxonomy_xml_for_I18N_MODE_LOCALIZE()

Gets XML data from specific taxonomy.

Parameters

object $term: The taxonomy term.

string $path: The taxonomy path.

Return value

array Associative array of block XML data.

2 calls to globallink_get_taxonomy_xml_for_I18N_MODE_LOCALIZE()
globallink_taxonomy_get_translations_for_row_id in globallink_taxonomy/globallink_taxonomy_receive.inc
Gets taxonomy translations by row ID.
globallink_taxonomy_send_for_translations in globallink_taxonomy/globallink_taxonomy.inc
Sends taxonomies for translation.

File

globallink_taxonomy/globallink_taxonomy.inc, line 171

Code

function globallink_get_taxonomy_xml_for_I18N_MODE_LOCALIZE($term, $path) {
  $dom = new DOMDocument('1.0', 'UTF-8');
  $dom->formatOutput = TRUE;
  $root = $dom
    ->createElement("content");
  $dom
    ->appendChild($root);
  $id = $dom
    ->createAttribute('bid');
  $id->value = $term->tid;
  $root
    ->appendChild($id);
  if (!empty($term->name)) {
    globallink_insert_child_element($dom, $root, "taxonomy", $term->name, array(
      'name' => 'name',
      'label' => 'Name',
    ));
  }
  if (!empty($term->description)) {
    globallink_insert_child_element($dom, $root, "taxonomy", $term->description, array(
      'name' => 'description',
      'label' => 'Description',
    ));
  }
  if (!empty($path)) {
    globallink_insert_child_element($dom, $root, "taxonomy", $path, array(
      'name' => 'path',
      'label' => 'Path',
    ));
  }
  $xml = $dom
    ->saveXML();
  return $xml;
}