README.txt 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. This module provides by default the ability to translate panel display and
  2. panel pane titles.
  3. Further it introduced an extension to the ctools content_types plugin.
  4. You can now define translatable settings which will be registered in i18n.
  5. Out of the box the module extends the custom content content_type to allow
  6. translation of the content.
  7. Requirements:
  8. Ctools 7.x-1.x-dev (Jan 28-2014 or newer)
  9. Panels 7.x-3.x-dev (Jan 28-2014 or newer)
  10. Plugin definition extension:
  11. ------------------------------
  12. This example shows how the content_type custom is extended:
  13. #### Default: ####
  14. /**
  15. * Plugins are described by creating a $plugin array which will be used
  16. * by the system that includes this file.
  17. */
  18. $plugin = array(
  19. 'title' => t('Custom content'),
  20. 'no title override' => TRUE,
  21. 'defaults' => array('admin_title' => '', 'title' => '', 'body' => '', 'format' => filter_fallback_format(), 'substitute' => TRUE),
  22. 'js' => array('misc/autocomplete.js', 'misc/textarea.js', 'misc/collapse.js'),
  23. // Make sure the edit form is only used for some subtypes.
  24. 'edit form' => '',
  25. 'add form' => '',
  26. 'edit text' => t('Edit'),
  27. 'all contexts' => TRUE,
  28. );
  29. #### Extended Configuration: ####
  30. /**
  31. * Plugins are described by creating a $plugin array which will be used
  32. * by the system that includes this file.
  33. */
  34. $plugin = array(
  35. 'title' => t('Custom content'),
  36. 'no title override' => TRUE,
  37. 'defaults' => array('admin_title' => '', 'title' => '', 'body' => '', 'format' => filter_fallback_format(), 'substitute' => TRUE),
  38. 'js' => array('misc/autocomplete.js', 'misc/textarea.js', 'misc/collapse.js'),
  39. // Make sure the edit form is only used for some subtypes.
  40. 'edit form' => '',
  41. 'add form' => '',
  42. 'edit text' => t('Edit'),
  43. 'all contexts' => TRUE,
  44. 'i18n_settings' = array(
  45. 'title',
  46. 'body' => array('format' => 'plain_text'),
  47. 'items|0|title'
  48. ),
  49. );
  50. The new key "i18n_settings" defines an array with the settings that are
  51. translatable. The array contains the names of the settings, they have to be
  52. available in the "defaults" array of the content definition. If you need to
  53. define a format use the name of the setting as the array item key and as item
  54. another array with the detail configuration. E.g
  55. 'i18n_settings' = array('body' => array('format' => 'plain_text'))
  56. If i18n_settings is a string it's used as callback. The expected return is an
  57. array equal to the one used in the fix configuration.
  58. You can even declare nested settings as translatable, to do so use '|' as
  59. delimiter.
  60. E.g. 'items|0|title' is evaluated as $settings['items'][0]['title']
  61. #### Callback: ####
  62. /**
  63. * Plugins are described by creating a $plugin array which will be used
  64. * by the system that includes this file.
  65. */
  66. $plugin = array(
  67. 'title' => t('Custom content'),
  68. 'no title override' => TRUE,
  69. 'defaults' => array('admin_title' => '', 'title' => '', 'body' => '', 'format' => filter_fallback_format(), 'substitute' => TRUE),
  70. 'js' => array('misc/autocomplete.js', 'misc/textarea.js', 'misc/collapse.js'),
  71. // Make sure the edit form is only used for some subtypes.
  72. 'edit form' => '',
  73. 'add form' => '',
  74. 'edit text' => t('Edit'),
  75. 'all contexts' => TRUE,
  76. 'i18n_settings' => 'ctools_custom_content_type_i18n_settings',
  77. );
  78. function ctools_custom_content_type_i18n_settings($conf) {
  79. return array(
  80. 'title',
  81. 'body' => array('format' => $conf['format']),
  82. );
  83. }