tmgmt_file.api.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /*
  3. * @file
  4. * API and hook documentation for the File Translator module.
  5. */
  6. /**
  7. * Provide information about available file format to export to and import from.
  8. *
  9. * @return
  10. * An array of available file format plugin definitions. The key is the file
  11. * extension for that format. It is therefore currently not possible to have
  12. * two file formats which share the same file extension as there needs to be
  13. * a way to identify them for the import. Each plugin info array then consists
  14. * of a label and a plugin controller class, which needs to implement
  15. * TMGMTFileFormatInterface.
  16. *
  17. * @see hook_tmgmt_file_format_plugin_info_alter()
  18. */
  19. function hook_tmgmt_file_format_plugin_info() {
  20. return array(
  21. 'xlf' => array(
  22. 'label' => t('XLIFF'),
  23. 'plugin controller class' => 'TMGMTFileFormatXLIFF',
  24. ),
  25. 'html' => array(
  26. 'label' => t('HTML'),
  27. 'plugin controller class' => 'TMGMTFileFormatHTML',
  28. ),
  29. );
  30. }
  31. /**
  32. * Provide information about available text processors.
  33. *
  34. * @return array
  35. * An array of available text processor definitions. The key is the text
  36. * processor name.
  37. */
  38. function hook_tmgmt_file_text_processor_plugin_info() {
  39. return array(
  40. 'mask_html_for_xliff' => array(
  41. 'label' => t('Escape HTML'),
  42. 'processor class' => 'TMGMTFileXLIFFMaskHTMLProcessor',
  43. ),
  44. );
  45. }
  46. /**
  47. * Alter file format plugins provided by other modules.
  48. *
  49. * @see hook_tmgmt_file_format_plugin_info()
  50. */
  51. function hook_tmgmt_file_format_plugin_info_alter($file_formats) {
  52. // Switch the used HTML plugin controller class.
  53. $file_formats['html']['plugin controller class'] = 'MyModuleCustomizedHTML';
  54. }