public function LingotekConfigTranslationService::updateDocument in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::updateDocument()
- 4.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::updateDocument()
- 3.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::updateDocument()
- 3.1.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::updateDocument()
- 3.2.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::updateDocument()
- 3.3.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::updateDocument()
- 3.4.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::updateDocument()
- 3.5.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::updateDocument()
- 3.6.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::updateDocument()
- 3.7.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::updateDocument()
- 3.8.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::updateDocument()
Resends a document to the translation service.
Parameters
\Drupal\Core\Config\Entity\ConfigEntityInterface $entity: The entity being updated.
Return value
boolean TRUE if the document was updated successfully, FALSE if not.
Overrides LingotekConfigTranslationServiceInterface::updateDocument
1 call to LingotekConfigTranslationService::updateDocument()
- LingotekConfigTranslationService::uploadDocument in src/
LingotekConfigTranslationService.php - Uploads a document to the Lingotek service.
File
- src/
LingotekConfigTranslationService.php, line 396 - Contains \Drupal\lingotek\LingotekConfigTranslationService.
Class
- LingotekConfigTranslationService
- Service for managing Lingotek configuration translations.
Namespace
Drupal\lingotekCode
public function updateDocument(ConfigEntityInterface &$entity) {
$source_data = $this
->getSourceData($entity);
$document_id = $this
->getDocumentId($entity);
$document_name = $entity
->id() . ' (config): ' . $entity
->label();
$url = $entity
->hasLinkTemplate('edit-form') ? $entity
->toUrl()
->setAbsolute()
->toString() : NULL;
// Allow other modules to alter the data before is uploaded.
\Drupal::moduleHandler()
->invokeAll('lingotek_config_entity_document_upload', [
&$source_data,
&$entity,
&$url,
]);
$encoded_data = json_encode($source_data);
if ($this->lingotek
->updateDocument($document_id, $encoded_data, $url, $document_name)) {
$this
->setSourceStatus($entity, Lingotek::STATUS_IMPORTING);
$this
->setTargetStatuses($entity, Lingotek::STATUS_PENDING);
return $document_id;
}
return FALSE;
}