function hook_lingotek_config_object_translation_presave in Lingotek Translation 3.4.x
Same name and namespace in other branches
- 8.2 lingotek.api.php \hook_lingotek_config_object_translation_presave()
- 4.0.x lingotek.api.php \hook_lingotek_config_object_translation_presave()
- 3.0.x lingotek.api.php \hook_lingotek_config_object_translation_presave()
- 3.1.x lingotek.api.php \hook_lingotek_config_object_translation_presave()
- 3.2.x lingotek.api.php \hook_lingotek_config_object_translation_presave()
- 3.3.x lingotek.api.php \hook_lingotek_config_object_translation_presave()
- 3.5.x lingotek.api.php \hook_lingotek_config_object_translation_presave()
- 3.6.x lingotek.api.php \hook_lingotek_config_object_translation_presave()
- 3.7.x lingotek.api.php \hook_lingotek_config_object_translation_presave()
- 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);
}