function webform_localization_component_update_translation_strings in Webform Localization 7.4
Same name and namespace in other branches
- 7 includes/webform_localization.i18n.inc \webform_localization_component_update_translation_strings()
Update / create translation source for all the translatable properties.
Parameters
array $component: A webform component.
3 calls to webform_localization_component_update_translation_strings()
- webform_localization_i18n_string_refresh in ./
webform_localization.module - Update / create / delete translation source for components.
- webform_localization_webform_component_insert in ./
webform_localization.module - Implements hook_webform_component_insert().
- webform_localization_webform_component_presave in ./
webform_localization.module - Implements hook_webform_component_presave().
File
- includes/
webform_localization.i18n.inc, line 128 - Webform Localization i18n_string integration.
Code
function webform_localization_component_update_translation_strings(&$component) {
// Fill in the the default values for the missing properties.
module_load_include('inc', 'webform', 'includes/webform.components');
webform_component_defaults($component);
// Render the 'render' FAPI array for the component.
$element = webform_component_invoke($component['type'], 'render', $component, NULL, 'html');
// Parse the renderable array to find the translatable properties and
// update / create translation source for them.
$component['extra']['translated_strings'] = _webform_localization_component_translation_parse($element, $component);
// Render the 'display' FAPI array for the component.
$element = webform_component_invoke($component['type'], 'display', $component, NULL, 'html');
// Parse the renderable array to find the translatable properties and
// update / create translation source for them.
$component['extra']['translated_strings'] = array_merge($component['extra']['translated_strings'], array_diff(_webform_localization_component_translation_parse($element, $component), $component['extra']['translated_strings']));
}