public function LingotekComment::updateLocalContent in Lingotek Translation 7.3
Same name and namespace in other branches
- 7.2 lib/Drupal/lingotek/LingotekComment.php \LingotekComment::updateLocalContent()
- 7.4 lib/Drupal/lingotek/LingotekComment.php \LingotekComment::updateLocalContent()
Updates the local content with data from a Lingotek Document.
Return value
bool TRUE if the content updates succeeded, FALSE otherwise.
Overrides LingotekTranslatableEntity::updateLocalContent
1 call to LingotekComment::updateLocalContent()
- LingotekComment::contentUpdated in lib/
Drupal/ lingotek/ LingotekComment.php - Event handler for updates to the comment's data.
File
- lib/
Drupal/ lingotek/ LingotekComment.php, line 343 - Defines LingotekComment.
Class
- LingotekComment
- A class wrapper for Lingotek-specific behavior on Comments.
Code
public function updateLocalContent() {
$success = TRUE;
$metadata = $this
->metadata();
$document_id = $metadata['document_id'];
if (empty($document_id)) {
LingotekLog::error('Unable to refresh local contents for comment @cid. Could not find Lingotek Document ID.', array(
'@cid' => $this->comment->cid,
));
return FALSE;
}
$api = LingotekApi::instance();
$document = $api
->getDocument($document_id);
foreach ($document->translationTargets as $target) {
$this
->updateLocalContentByTarget($target->language);
}
return $success;
}