You are here

function lingotek_test_lingotek_content_entity_document_upload in Lingotek Translation 8

Same name and namespace in other branches
  1. 8.2 tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_content_entity_document_upload()
  2. 4.0.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_content_entity_document_upload()
  3. 3.0.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_content_entity_document_upload()
  4. 3.1.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_content_entity_document_upload()
  5. 3.2.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_content_entity_document_upload()
  6. 3.3.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_content_entity_document_upload()
  7. 3.4.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_content_entity_document_upload()
  8. 3.5.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_content_entity_document_upload()
  9. 3.6.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_content_entity_document_upload()
  10. 3.7.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_content_entity_document_upload()
  11. 3.8.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_content_entity_document_upload()

Implements hook_lingotek_content_entity_document_upload().

If the document being uploaded is a press release, we add a field with the publication and we modify the original url.

File

tests/modules/lingotek_test/lingotek_test.module, line 28

Code

function lingotek_test_lingotek_content_entity_document_upload(array &$source_data, ContentEntityInterface &$entity, &$url) {
  if ($entity
    ->getEntityTypeId() === 'node' && $entity
    ->bundle() === 'animal') {
    $url = \Drupal::request()
      ->getBasePath() . '/animal/2016/llamas-are-cool';
    $source_data['animal_date'] = '2016-05-01';
  }
}