webform_localization.api.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * @file
  4. * Webform localization hooks.
  5. */
  6. /**
  7. * Module specific instance of _webform_localization_csv_header().
  8. *
  9. * This allows each component to translate the analysis report CSV header.
  10. * These are found in under 'translated_strings' in the 'extra' array of the
  11. * component, which is build when the component is inserted / updated, or
  12. * when all webform strings are updated from
  13. * admin/config/regional/translate/i18n_string.
  14. *
  15. * @param array $header
  16. * The untranslated CSV header to be altered.
  17. * @param array $component
  18. * The webform component.
  19. *
  20. * @return array
  21. * The translated header array.
  22. */
  23. function _webform_localization_csv_header_component($header, $component) {
  24. $header[1] = 'Custom string';
  25. return $header;
  26. }
  27. /**
  28. * Module specific instance of _webform_localization_csv_data().
  29. *
  30. * This allows each component to translate the analysis report CSV data.
  31. *
  32. * @param array $data
  33. * The untranslated CSV data to be altered.
  34. * @param array $component
  35. * The webform component.
  36. * @param array $submission
  37. * The webform submission.
  38. *
  39. * @return array
  40. * The translated data array.
  41. */
  42. function _webform_localization_csv_data_component($data, $component, $submission) {
  43. $data[1] = 'Custom string';
  44. return $data;
  45. }
  46. /**
  47. * Module specific instance of _webform_localization_analysis_data().
  48. *
  49. * This allows each component to translate the analysis report data.
  50. * These are found in under 'translated_strings' in the 'extra' array of the
  51. * component, which is build when the component is inserted / updated, or
  52. * when all webform strings are updated from
  53. * admin/config/regional/translate/i18n_string.
  54. *
  55. * @param array $data
  56. * The untranslated data to be altered
  57. * @param object $node
  58. * The webform node.
  59. * @param array $component
  60. * The webform component.
  61. *
  62. * @return array
  63. * The translated data array.
  64. */
  65. function _webform_localization_analysis_data_component($data, $node, $component) {
  66. $data[1] = 'Custom string';
  67. return $data;
  68. }