public function LingotekApi::updateContentDocument in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::updateContentDocument()
- 7.2 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::updateContentDocument()
- 7.3 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::updateContentDocument()
- 7.4 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::updateContentDocument()
- 7.5 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::updateContentDocument()
Updates the content of an existing Lingotek document with the current object contents.
Parameters
stdClass $translatable_object: A Drupal node object or another object, such as a config chunk, etc.
Return value
bool TRUE on success, FALSE on failure.
File
- lib/
Drupal/ lingotek/ LingotekApi.php, line 146 - Defines Drupal\lingotek\LingotekApi
Class
- LingotekApi
- @file Defines Drupal\lingotek\LingotekApi
Code
public function updateContentDocument($translatable_object) {
$parameters['documentId'] = $translatable_object
->getMetadataValue('document_id');
$parameters['documentName'] = $translatable_object
->getDocumentName();
$parameters['documentDesc'] = $translatable_object
->getDescription();
$parameters['content'] = $translatable_object
->documentLingotekXML();
$parameters['url'] = $translatable_object
->getUrl();
$parameters['format'] = $this
->xmlFormat();
$this
->addAdvancedParameters($parameters, $translatable_object);
$result = $this
->request('updateContentDocumentAsync', $parameters);
if ($result) {
if (get_class($translatable_object) == 'LingotekConfigSet') {
$translatable_object
->setStatus(LingotekSync::STATUS_CURRENT);
$translatable_object
->setTargetsStatus(LingotekSync::STATUS_PENDING);
// WTD: there is a race condition here where a user could modify a locales-
// source entry between the time the dirty segments are pulled and the time
// they are set to current at this point. This same race condition exists
// for nodes as well; however, the odds may be lower due to number of entries.
LingotekConfigSet::setSegmentStatusToCurrentById($translatable_object
->getId());
}
}
return $result ? TRUE : FALSE;
}