2 // $Id: translation.views.inc,v 1.8 2009/01/07 23:13:46 merlinofchaos Exp $
7 * Provide views data and handlers for translation.module
11 * @defgroup views_translation_module translation.module handlers
17 * Implementation of hook_views_data_alter().
19 * Add translation information to the node table.
21 function translation_views_data_alter(&$data) {
24 $data['node']['table']['join']['node'] = array(
25 'left_field' => 'tnid',
30 $data['node']['language'] = array(
31 'group' => t('Node translation'),
32 'title' => t('Language'),
33 'help' => t('The language the content is in.'),
35 'handler' => 'views_handler_field_node_language',
36 'click sortable' => TRUE,
39 'handler' => 'views_handler_filter_node_language',
42 'handler' => 'views_handler_argument_node_language',
46 // The translation ID (nid of the "source" translation)
47 $data['node']['tnid'] = array(
48 'group' => t('Node translation'),
49 'title' => t('Translation set node ID'),
50 'help' => t('The ID of the translation set the content belongs to.'),
52 'handler' => 'views_handler_field_node',
53 'click sortable' => TRUE,
56 'handler' => 'views_handler_filter_numeric',
59 'handler' => 'views_handler_argument_node_tnid',
60 'parent' => 'views_handler_argument_numeric', // make sure parent is included
61 'name field' => 'title', // the field to display in the summary.
63 'validate type' => 'tnid',
66 'handler' => 'views_handler_sort',
68 'relationship' => array(
69 'title' => t('Source translation'),
70 'help' => t('The source that this content was translated from.'),
72 'base field' => 'nid',
73 'handler' => 'views_handler_relationship',
74 'label' => t('Source translation'),
78 // The source translation.
79 $data['node']['translation'] = array(
80 'group' => t('Node translation'),
81 'title' => t('Translations'),
82 'help' => t('Versions of content in different languages.'),
83 'relationship' => array(
84 'title' => t('Translations'),
85 'help' => t('Versions of content in different languages.'),
87 'base field' => 'tnid',
88 'relationship table' => 'node',
89 'relationship field' => 'nid',
90 'handler' => 'views_handler_relationship_translation',
91 'label' => t('Translations'),
95 // The source translation.
96 $data['node']['source_translation'] = array(
97 'group' => t('Node translation'),
98 'title' => t('Source translation'),
99 'help' => t('Nodes that are either untranslated or are the original versions of a translation set.'),
101 'handler' => 'views_handler_filter_node_tnid',
105 // The source translation.
106 $data['node']['child_translation'] = array(
107 'group' => t('Node translation'),
108 'title' => t('Child translation'),
109 'help' => t('Nodes that are translations of a source translation.'),
111 'handler' => 'views_handler_filter_node_tnid_child',
115 // Translation status
116 $data['node']['translate'] = array(
117 'group' => t('Node translation'),
118 'title' => t('Translation status'),
119 'help' => t('The translation status of the node--whether or not the translation needs to be updated.'),
121 'handler' => 'views_handler_field_boolean',
122 'click sortable' => TRUE,
125 'handler' => 'views_handler_filter_boolean_operator',
126 'label' => t('Outdated'),
130 'handler' => 'views_handler_sort',
137 * Implementation of hook_views_handlers() to register all of the basic handlers
140 function translation_views_handlers() {
143 'path' => drupal_get_path('module', 'views') . '/modules/translation',
147 'views_handler_field_node_language' => array(
148 'parent' => 'views_handler_field_node',
151 'views_handler_argument_node_language' => array(
152 'parent' => 'views_handler_argument',
154 'views_handler_argument_node_tnid' => array(
155 'parent' => 'views_handler_argument',
158 'views_handler_filter_node_language' => array(
159 'parent' => 'views_handler_filter_in_operator',
161 'views_handler_filter_node_tnid' => array(
162 'parent' => 'views_handler_filter',
165 'views_handler_relationship_translation' => array(
166 'parent' => 'views_handler_relationship',
168 'views_handler_filter_node_tnid_child' => array(
169 'parent' => 'views_handler_filter',