function lingotek_test_lingotek_config_entity_document_upload in Lingotek Translation 4.0.x
Same name and namespace in other branches
- 8 tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_config_entity_document_upload()
- 8.2 tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_config_entity_document_upload()
- 3.0.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_config_entity_document_upload()
- 3.1.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_config_entity_document_upload()
- 3.2.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_config_entity_document_upload()
- 3.3.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_config_entity_document_upload()
- 3.4.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_config_entity_document_upload()
- 3.5.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_config_entity_document_upload()
- 3.6.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_config_entity_document_upload()
- 3.7.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_config_entity_document_upload()
- 3.8.x tests/modules/lingotek_test/lingotek_test.module \lingotek_test_lingotek_config_entity_document_upload()
Implements hook_lingotek_config_entity_document_upload().
File
- tests/
modules/ lingotek_test/ lingotek_test.module, line 82 - Provides a fake Lingotek API endpoint and other help for testing purposes.
Code
function lingotek_test_lingotek_config_entity_document_upload(array &$source_data, ConfigEntityInterface &$entity, &$url) {
switch ($entity
->getEntityTypeId()) {
case 'block':
// Uppercase all [tokens] and prefix with asterisks.
$yaml = Yaml::encode($source_data);
$yaml = preg_replace_callback('/\\[([a-z][^]]+)\\]/', function ($matches) {
return '[***' . strtoupper($matches[1]) . '***]';
}, $yaml);
$source_data = Yaml::decode($yaml);
break;
}
}