You are here

function hook_lingotek_content_entity_document_upload in Lingotek Translation 8

Same name and namespace in other branches
  1. 8.2 lingotek.api.php \hook_lingotek_content_entity_document_upload()
  2. 4.0.x lingotek.api.php \hook_lingotek_content_entity_document_upload()
  3. 3.0.x lingotek.api.php \hook_lingotek_content_entity_document_upload()
  4. 3.1.x lingotek.api.php \hook_lingotek_content_entity_document_upload()
  5. 3.2.x lingotek.api.php \hook_lingotek_content_entity_document_upload()
  6. 3.3.x lingotek.api.php \hook_lingotek_content_entity_document_upload()
  7. 3.4.x lingotek.api.php \hook_lingotek_content_entity_document_upload()
  8. 3.5.x lingotek.api.php \hook_lingotek_content_entity_document_upload()
  9. 3.6.x lingotek.api.php \hook_lingotek_content_entity_document_upload()
  10. 3.7.x lingotek.api.php \hook_lingotek_content_entity_document_upload()
  11. 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 57

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();
  }
}