function lingotek_xml_node_body in Lingotek Translation 7.4
Same name and namespace in other branches
- 7.2 lingotek.util.inc \lingotek_xml_node_body()
- 7.3 lingotek.util.inc \lingotek_xml_node_body()
Return the xml representation of the source content for a node.
Parameters
object $node: A Drupal node.
Return value
string The XML representation of the node in Lingotek format.
3 calls to lingotek_xml_node_body()
- LingotekApi::updateContentDocument in lib/
Drupal/ lingotek/ LingotekApi.php - Updates the content of an existing Lingotek document with the current object contents.
- LingotekNode::documentLingotekXML in lib/
Drupal/ lingotek/ LingotekNode.php - Gets the contents of this item formatted as XML that can be sent to Lingotek.
- lingotek_upload_document in ./
lingotek.module
File
- ./
lingotek.util.inc, line 267 - Utility functions.
Code
function lingotek_xml_node_body($node) {
$translatable = array();
$fields_desired = lingotek_get_enabled_fields('node', $node->type);
foreach ($fields_desired as $value) {
$field = field_info_field($value);
if (isset($field)) {
array_push($translatable, $value);
}
}
$content = lingotek_xml_fields($node, $translatable, $node->language);
/* deprecated with config translation
//Menus related to the page:
// Do we still want this? Config translation translates these items
$menu = menu_link_get_preferred('node/' . $node->nid);
$txt = $menu['link_title'];
if ($txt != "") {
$content = $content . "<menu_title><![CDATA[$txt]]></menu_title>\n";
} */
//URL Alias related to the page:
$url_alias_translation = $node->lingotek['url_alias_translation'];
if ($url_alias_translation == 1) {
$conditions = array(
'source' => 'node/' . $node->nid,
);
if ($node->language != LANGUAGE_NONE) {
$conditions['language'] = $node->language;
}
$path = path_load($conditions);
if ($path !== FALSE) {
$url = $path['alias'];
$content = $content . "<url_alias><![CDATA[{$url}]]></url_alias>\n";
}
}
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?><contents>{$content}</contents>";
}