You are here

function globallink_entity_get_xml in GlobalLink Connect for Drupal 7.7

Same name and namespace in other branches
  1. 7.5 globallink_entity/globallink_entity.inc \globallink_entity_get_xml()
  2. 7.6 globallink_entity/globallink_entity.inc \globallink_entity_get_xml()

Gets XML data from specific entity.

Parameters

object $node: The entity node.

array $target_arr: The target array

string $tnid: The translated entity node ID. Defaults to NULL.

string $tvid: The translated entity VID. Defaults to NULL.

string $name: The node name. Defaults to empty.

bool $for_display: Whether or not the XML will be displayed. Defaults to FALSE.

string $source_lang: The source language of the entity. Defaults to empty.

Return value

XML representation of the entity. GLOBALLINK_STATUS_TRANSLATION_SOURCE_DELETED if the entity no longer exists.

1 call to globallink_entity_get_xml()
globallink_entity_send_for_translations in globallink_entity/globallink_entity.inc
Sends entities for translation.

File

globallink_entity/globallink_entity.inc, line 828

Code

function globallink_entity_get_xml($node, $target_arr, $tnid = NULL, $tvid = NULL, &$name = '', $for_display = FALSE, $source_lang = '') {
  if (is_null($node)) {
    return GLOBALLINK_STATUS_TRANSLATION_SOURCE_DELETED;
  }
  elseif (!$node) {
    return GLOBALLINK_STATUS_TRANSLATION_SOURCE_DELETED;
  }
  if ($node && is_object($node)) {
    if ($node->language != 'en') {
      $name = 'Node_' . $node->nid . '_Non_English' . $name;
    }
    else {
      $name = globallink_format_file_name($node->title) . '_' . $node->nid . $name;
    }
    $xml = globallink_entity_generate_xml_document($node, $target_arr, $tnid, $tvid, $for_display, $source_lang);
    return $xml;
  }
  return GLOBALLINK_STATUS_TRANSLATION_SOURCE_DELETED;
}