i18n_node.variable.inc 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. /**
  3. * @file
  4. * Variable information
  5. */
  6. /**
  7. * Implements hook_variable_group_info().
  8. */
  9. function i18n_node_variable_group_info() {
  10. $groups['i18n_node'] = array(
  11. 'title' => t('Multilingual node options'),
  12. 'description' => t('Extended node options for multilingual sites.'),
  13. 'access' => 'administer site configuration',
  14. 'path' => 'admin/config/regional/i18n/node',
  15. );
  16. return $groups;
  17. }
  18. /**
  19. * Implements hook_variable_info().
  20. */
  21. function i18n_node_variable_info($options = array()) {
  22. $variables['i18n_hide_translation_links'] = array(
  23. 'type' => 'boolean',
  24. 'title' => t('Hide content translation links', array(), $options),
  25. 'description' => t('Hide the links to translations in content body and teasers. If you choose this option, switching language will only be available from the language switcher block.', array(), $options),
  26. 'default' => 0,
  27. 'group' => 'i18n_node',
  28. );
  29. $variables['i18n_node_default_language_none'] = array(
  30. 'title' => t('Default language for content types with Multilingual support disabled.', array(), $options),
  31. 'description' => t('Determines which language will be set for newly created content of types that don\'t have Multilingual support enabled.', array(), $options),
  32. 'type' => 'select',
  33. 'options' => array(
  34. 0 => t('The site\'s default language (Default behaviour).', array(), $options),
  35. 1 => t('Language neutral (Recommended).', array(), $options)
  36. ),
  37. 'default' => 0,
  38. 'group' => 'i18n_node',
  39. );
  40. $variables['i18n_node_options_[node_type]'] = array(
  41. 'type' => 'multiple',
  42. 'title' => t('Extended language options', array(), $options),
  43. 'repeat' => array(
  44. 'type' => 'options',
  45. 'options' => array(
  46. // Note: this was previously used only to mark new, translatable nodes
  47. // with the current language of the user. Now, this setting is extended
  48. // to allow a specific language to be chosen (defaulting to the current
  49. // language). This was done for backwards compatibility reasons.
  50. 'current' => t('Set custom language as default for new content.', array(), $options),
  51. 'required' => t('Require language (Do not allow Language Neutral).', array(), $options),
  52. 'lock' => t('Lock language (Cannot be changed).', array(), $options),
  53. ),
  54. ),
  55. 'group' => 'i18n',
  56. );
  57. // This field will only be displayed if "current" is checked above.
  58. $variables['i18n_node_default_language_for_[node_type]'] = array(
  59. 'type' => 'multiple',
  60. 'title' => t('Custom default language', array(), $options),
  61. 'repeat' => array(
  62. 'type' => 'select',
  63. 'options' => array_merge(array(
  64. '-- current --' => t('Current language')
  65. ), locale_language_list('name')),
  66. 'default' => '-- current --',
  67. ),
  68. 'group' => 'i18n',
  69. );
  70. $variables['i18n_node_extended_[node_type]'] = array(
  71. 'type' => 'multiple',
  72. 'title' => t('Extended language support'),
  73. 'repeat' => array(
  74. 'type' => 'select',
  75. 'options callback' => 'i18n_node_variable_extended_options',
  76. 'default' => I18N_LANGUAGE_ENABLED,
  77. ),
  78. 'description' => t('If enabled, all defined languages will be allowed for this content type in addition to only enabled ones. This is useful to have more languages for content than for the interface.', array(), $options),
  79. 'group' => 'i18n',
  80. );
  81. return $variables;
  82. }
  83. /**
  84. * Options callback for i18n_node_extended_
  85. */
  86. function i18n_node_variable_extended_options($variable, $options) {
  87. return array(
  88. I18N_LANGUAGE_ENABLED => t('Normal - All enabled languages will be allowed.', array(), $options),
  89. I18N_LANGUAGE_EXTENDED => t('Extended - All defined languages will be allowed.', array(), $options),
  90. I18N_LANGUAGE_EXTENDED | I18N_LANGUAGE_HIDDEN => t('Extended, but not displayed - All defined languages will be allowed for input, but not displayed in links.', array(), $options),
  91. );
  92. }