function webform_localization_component_sync in Webform Localization 7.4
Same name and namespace in other branches
- 7 includes/webform_localization.component.sync.inc \webform_localization_component_sync()
Synchronize the changed component with it's translations versions.
Parameters
array $component: A webform component that have been modified.
array $translations: An Array of the translated webform components to sync with.
1 call to webform_localization_component_sync()
File
- includes/
webform_localization.component.sync.inc, line 70 - Webform Localization Component Sync Functions.
Code
function webform_localization_component_sync($component, &$translations) {
// Get properties to sync.
// $sync_properties['standar_values'] = array('mandatory', 'weight', 'pid');
// $sync_properties['extra_values'] = array('options', 'private');
$sync_properties = webform_localization_synchronizable_properties($component);
foreach ($translations as $component_key => $translation) {
foreach ($sync_properties['standar_values'] as $sync_key) {
if (is_string($sync_key)) {
$translations[$component_key][$sync_key] = $component[$sync_key];
}
}
foreach ($sync_properties['extra_values'] as $extra_key) {
if (is_string($extra_key) && isset($component['extra'][$extra_key])) {
$translations[$component_key]['extra'][$extra_key] = $component['extra'][$extra_key];
}
}
}
}