function hook_lingotek_content_entity_document_upload in Lingotek Translation 3.4.x
Same name and namespace in other branches
- 8 lingotek.api.php \hook_lingotek_content_entity_document_upload()
- 8.2 lingotek.api.php \hook_lingotek_content_entity_document_upload()
- 4.0.x lingotek.api.php \hook_lingotek_content_entity_document_upload()
- 3.0.x lingotek.api.php \hook_lingotek_content_entity_document_upload()
- 3.1.x lingotek.api.php \hook_lingotek_content_entity_document_upload()
- 3.2.x lingotek.api.php \hook_lingotek_content_entity_document_upload()
- 3.3.x lingotek.api.php \hook_lingotek_content_entity_document_upload()
- 3.5.x lingotek.api.php \hook_lingotek_content_entity_document_upload()
- 3.6.x lingotek.api.php \hook_lingotek_content_entity_document_upload()
- 3.7.x lingotek.api.php \hook_lingotek_content_entity_document_upload()
- 3.8.x lingotek.api.php \hook_lingotek_content_entity_document_upload()
Act on the data extracted from an an content entity before it is uploaded to Lingotek.
Parameters
array &$source_data: The data that will be uploaded, as an associative array.
\Drupal\Core\Entity\ContentEntityInterface &$entity: The content entity where the data is extracted from and will be associated to the Lingotek document.
string &$url: The url which will be associated to this document, e.g. for context review.
Related topics
1 function implements hook_lingotek_content_entity_document_upload()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- lingotek_test_lingotek_content_entity_document_upload in tests/
modules/ lingotek_test/ lingotek_test.module - Implements hook_lingotek_content_entity_document_upload().
2 invocations of hook_lingotek_content_entity_document_upload()
- LingotekContentTranslationService::updateDocument in src/
LingotekContentTranslationService.php - Resends a document to the translation service.
- LingotekContentTranslationService::uploadDocument in src/
LingotekContentTranslationService.php - Uploads a document to the Lingotek service.
File
- ./
lingotek.api.php, line 63 - Hooks provided by the Lingotek module.
Code
function hook_lingotek_content_entity_document_upload(array &$source_data, ContentEntityInterface &$entity, &$url) {
// In this example, press releases pages are always displayed in a view, so we
// want to send a different url for in context review.
if ($entity
->getEntityTypeId() === 'node' && $entity
->bundle() === 'press_release') {
$url = \Drupal::request()
->getBasePath() . '/press-release/view-path/' . $entity
->id();
}
}