translation.views.inc

  1. cis7 sites/all/modules/ulmus/views/modules/translation.views.inc
  2. cle7 sites/all/modules/ulmus/views/modules/translation.views.inc
  3. ecd7 sites/all/modules/ulmus/views/modules/translation.views.inc
  4. elmsmedia7 sites/all/modules/ulmus/views/modules/translation.views.inc
  5. harmony7 sites/all/modules/ulmus/views/modules/translation.views.inc
  6. icor7 sites/all/modules/ulmus/views/modules/translation.views.inc
  7. meedjum_blog7 sites/all/modules/ulmus/views/modules/translation.views.inc
  8. mooc7 sites/all/modules/ulmus/views/modules/translation.views.inc

Provide views data and handlers for translation.module.

Functions

File

sites/all/modules/ulmus/views/modules/translation.views.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Provide views data and handlers for translation.module.
  5. *
  6. * @ingroup views_module_handlers
  7. */
  8. /**
  9. * Implements hook_views_data_alter().
  10. *
  11. * Add translation information to the node table.
  12. */
  13. function translation_views_data_alter(&$data) {
  14. // Joins
  15. $data['node']['table']['join']['node'] = array(
  16. 'left_field' => 'tnid',
  17. 'field' => 'tnid',
  18. );
  19. // The translation ID (nid of the "source" translation)
  20. $data['node']['tnid'] = array(
  21. 'group' => t('Content translation'),
  22. 'title' => t('Translation set node ID'),
  23. 'help' => t('The ID of the translation set the content belongs to.'),
  24. 'field' => array(
  25. 'handler' => 'views_handler_field_node',
  26. 'click sortable' => TRUE,
  27. ),
  28. 'filter' => array(
  29. 'handler' => 'views_handler_filter_numeric',
  30. ),
  31. 'argument' => array(
  32. 'handler' => 'views_handler_argument_node_tnid',
  33. 'name field' => 'title', // the field to display in the summary.
  34. 'numeric' => TRUE,
  35. 'validate type' => 'tnid',
  36. ),
  37. 'sort' => array(
  38. 'handler' => 'views_handler_sort',
  39. ),
  40. 'relationship' => array(
  41. 'title' => t('Source translation'),
  42. 'help' => t('The source that this content was translated from.'),
  43. 'base' => 'node',
  44. 'base field' => 'nid',
  45. 'handler' => 'views_handler_relationship',
  46. 'label' => t('Source translation'),
  47. ),
  48. );
  49. // The source translation.
  50. $data['node']['translation'] = array(
  51. 'group' => t('Content translation'),
  52. 'title' => t('Translations'),
  53. 'help' => t('Versions of content in different languages.'),
  54. 'relationship' => array(
  55. 'title' => t('Translations'),
  56. 'help' => t('Versions of content in different languages.'),
  57. 'base' => 'node',
  58. 'base field' => 'tnid',
  59. 'relationship table' => 'node',
  60. 'relationship field' => 'nid',
  61. 'handler' => 'views_handler_relationship_translation',
  62. 'label' => t('Translations'),
  63. ),
  64. );
  65. // The source translation.
  66. $data['node']['source_translation'] = array(
  67. 'group' => t('Content translation'),
  68. 'title' => t('Source translation'),
  69. 'help' => t('Content that is either untranslated or is the original version of a translation set.'),
  70. 'filter' => array(
  71. 'handler' => 'views_handler_filter_node_tnid',
  72. ),
  73. );
  74. // The source translation.
  75. $data['node']['child_translation'] = array(
  76. 'group' => t('Node translation'),
  77. 'title' => t('Child translation'),
  78. 'help' => t('Content that is a translation of a source translation.'),
  79. 'filter' => array(
  80. 'handler' => 'views_handler_filter_node_tnid_child',
  81. ),
  82. );
  83. // Translation status
  84. $data['node']['translate'] = array(
  85. 'group' => t('Content translation'),
  86. 'title' => t('Translation status'),
  87. 'help' => t('The translation status of the content - whether or not the translation needs to be updated.'),
  88. 'field' => array(
  89. 'handler' => 'views_handler_field_boolean',
  90. 'click sortable' => TRUE,
  91. ),
  92. 'filter' => array(
  93. 'handler' => 'views_handler_filter_boolean_operator',
  94. 'label' => t('Outdated'),
  95. 'type' => 'yes-no',
  96. ),
  97. 'sort' => array(
  98. 'handler' => 'views_handler_sort',
  99. ),
  100. );
  101. // Translate node link.
  102. $data['node']['translate_node'] = array(
  103. 'group' => t('Content translation'),
  104. 'title' => t('Translate link'),
  105. 'help' => t('Provide a simple link to translate the node.'),
  106. 'field' => array(
  107. 'handler' => 'views_handler_field_node_link_translate',
  108. ),
  109. );
  110. }

Related topics