/** * Gets the contents of this item formatted as XML that can be sent to Lingotek. * * @return string * The XML document representing the entity's translatable content. */ public function documentLingotekXML() { return lingotek_xml_node_body($this->node); }
/** * Updates the content of an existing Lingotek document with the current node contents. * * @param stdClass $node * A Drupal node object. * * @return bool * TRUE on success, FALSE on failure. */ public function updateContentDocument($node) { switch (get_class($node)) { case 'LingotekComment': // Comments have their own way to format the content. $document_id = $node->getMetadataValue('document_id'); $content = $node->documentLingotekXML(); break; default: // Normal content do the regular formating. $document_id = lingotek_lingonode($node->nid, 'document_id'); $content = lingotek_xml_node_body($node); break; } $parameters = array('documentId' => $document_id, 'documentName' => $node->title, 'documentDesc' => $node->title, 'content' => $content, 'format' => $this->xmlFormat()); $this->addAdvancedParameters($parameters, $node); $result = $this->request('updateContentDocument', $parameters); if ($result) { LingotekSync::setNodeAndTargetsStatus($node->nid, LingotekSync::STATUS_CURRENT, LingotekSync::STATUS_PENDING); } return $result ? TRUE : FALSE; }