You are here

function webform_localization_webform_analysis_component_data_alter in Webform Localization 7.4

Implements hook_webform_analysis_component_data_alter().

File

./webform_localization.module, line 447
Webform localization module.

Code

function webform_localization_webform_analysis_component_data_alter(&$data, $node, &$component) {

  // Gets webform localization options that match this node ID.
  $wl_options = webform_localization_get_config($node->nid);

  // Translate the translatable properties.
  if ($wl_options['expose_strings']) {

    // Translate component name, this is not a component spesific property.
    foreach ($component['extra']['translated_strings'] as $name) {
      $name_list = explode(':', $name);

      // Translate component name from title property.
      if ($name_list[3] == '#title') {
        $component['name'] = i18n_string($name, $component['name']);
        break;
      }
    }

    // Translate data array.
    $result = webform_localization_component_invoke($component['type'], 'analysis_data', $data, $node, $component);
    if (!empty($result)) {
      $data = $result;
    }
  }
}