5 * Provide views data and handlers for translation.module.
7 * @ingroup views_module_handlers
11 * Implements hook_views_data_alter().
13 * Add translation information to the node table.
15 function translation_views_data_alter(&$data) {
18 $data['node']['table']['join']['node'] = array(
19 'left_field' => 'tnid',
23 // The translation ID (nid of the "source" translation)
24 $data['node']['tnid'] = array(
25 'group' => t('Content translation'),
26 'title' => t('Translation set node ID'),
27 'help' => t('The ID of the translation set the content belongs to.'),
29 'handler' => 'views_handler_field_node',
30 'click sortable' => TRUE,
33 'handler' => 'views_handler_filter_numeric',
36 'handler' => 'views_handler_argument_node_tnid',
37 'name field' => 'title', // the field to display in the summary.
39 'validate type' => 'tnid',
42 'handler' => 'views_handler_sort',
44 'relationship' => array(
45 'title' => t('Source translation'),
46 'help' => t('The source that this content was translated from.'),
48 'base field' => 'nid',
49 'handler' => 'views_handler_relationship',
50 'label' => t('Source translation'),
55 $data['node']['translation'] = array(
56 'group' => t('Content translation'),
57 'title' => t('Translations'),
58 'help' => t('Versions of content in different languages.'),
59 'relationship' => array(
60 'title' => t('Translations'),
61 'help' => t('Versions of content in different languages.'),
63 'base field' => 'tnid',
64 'relationship table' => 'node',
65 'relationship field' => 'tnid',
66 'handler' => 'views_handler_relationship_translation',
67 'label' => t('Translations'),
71 // The source translation.
72 $data['node']['source_translation'] = array(
73 'group' => t('Content translation'),
74 'title' => t('Source translation'),
75 'help' => t('Content that is either untranslated or is the original version of a translation set.'),
77 'handler' => 'views_handler_filter_node_tnid',
82 $data['node']['child_translation'] = array(
83 'group' => t('Node translation'),
84 'title' => t('Child translation'),
85 'help' => t('Content that is a translation of a source translation.'),
87 'handler' => 'views_handler_filter_node_tnid_child',
92 $data['node']['translate'] = array(
93 'group' => t('Content translation'),
94 'title' => t('Translation status'),
95 'help' => t('The translation status of the content - whether or not the translation needs to be updated.'),
97 'handler' => 'views_handler_field_boolean',
98 'click sortable' => TRUE,
101 'handler' => 'views_handler_filter_boolean_operator',
102 'label' => t('Outdated'),
106 'handler' => 'views_handler_sort',
110 // Translate node link.
111 $data['node']['translate_node'] = array(
112 'group' => t('Content translation'),
113 'title' => t('Translate link'),
114 'help' => t('Provide a simple link to translate the node.'),
116 'handler' => 'views_handler_field_node_link_translate',