public function LingotekFake::updateDocument in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::updateDocument()
- 4.0.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::updateDocument()
- 3.0.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::updateDocument()
- 3.1.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::updateDocument()
- 3.2.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::updateDocument()
- 3.3.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::updateDocument()
- 3.4.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::updateDocument()
- 3.5.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::updateDocument()
- 3.6.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::updateDocument()
- 3.7.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::updateDocument()
- 3.8.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::updateDocument()
Updates a document in the Lingotek service.
Parameters
string $doc_id: The document id to update.
$content: The content of the document
string $url: (optional) The document url in the site if any. This allows support for in-context review.
string $title: (optional) The title of the document as it will be seen in the TMS.
Return value
boolean
Overrides LingotekInterface::updateDocument
File
- tests/
modules/ lingotek_test/ src/ LingotekFake.php, line 186
Class
Namespace
Drupal\lingotek_testCode
public function updateDocument($doc_id, $content, $url = NULL, $title = NULL) {
if (\Drupal::state()
->get('lingotek.must_error_in_upload', FALSE)) {
throw new LingotekApiException();
}
\Drupal::state()
->set('lingotek.uploaded_content', $content);
\Drupal::state()
->set('lingotek.uploaded_content_url', $url);
\Drupal::state()
->set('lingotek.uploaded_content_title', $title);
// Save the timestamp of the upload.
$timestamps = \Drupal::state()
->get('lingotek.upload_timestamps', []);
$timestamps[$doc_id] = REQUEST_TIME;
\Drupal::state()
->set('lingotek.upload_timestamps', $timestamps);
// Our document is always imported correctly.
return TRUE;
}