You are here

function hook_lingotek_config_object_translation_presave in Lingotek Translation 3.4.x

Same name and namespace in other branches
  1. 8.2 lingotek.api.php \hook_lingotek_config_object_translation_presave()
  2. 4.0.x lingotek.api.php \hook_lingotek_config_object_translation_presave()
  3. 3.0.x lingotek.api.php \hook_lingotek_config_object_translation_presave()
  4. 3.1.x lingotek.api.php \hook_lingotek_config_object_translation_presave()
  5. 3.2.x lingotek.api.php \hook_lingotek_config_object_translation_presave()
  6. 3.3.x lingotek.api.php \hook_lingotek_config_object_translation_presave()
  7. 3.5.x lingotek.api.php \hook_lingotek_config_object_translation_presave()
  8. 3.6.x lingotek.api.php \hook_lingotek_config_object_translation_presave()
  9. 3.7.x lingotek.api.php \hook_lingotek_config_object_translation_presave()
  10. 3.8.x lingotek.api.php \hook_lingotek_config_object_translation_presave()

Act on a translation of a config entity before it is saved or updated after being downloaded from Lingotek.

Parameters

array &$data: Data returned from the Lingotek service when asking for the translation.

string $config_name: The simple configuration name.

Related topics

1 function implements hook_lingotek_config_object_translation_presave()

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_config_object_translation_presave in tests/modules/lingotek_test/lingotek_test.module
Implements hook_lingotek_content_object_translation_presave().
1 invocation of hook_lingotek_config_object_translation_presave()
LingotekConfigTranslationService::downloadConfig in src/LingotekConfigTranslationService.php
Downloads a document to the Lingotek service.

File

./lingotek.api.php, line 171
Hooks provided by the Lingotek module.

Code

function hook_lingotek_config_object_translation_presave(array &$data, $config_name) {

  // Decode all [tokens].
  $yaml = Yaml::encode($data);
  $yaml = preg_replace_callback('/\\[\\*\\*\\*([^]]+)\\*\\*\\*\\]/', function ($matches) {
    return '[' . base64_decode($matches[1]) . ']';
  }, $yaml);
  $data = Yaml::decode($yaml);
}