/[drupal]/contributions/modules/views/modules/locale.views.inc
ViewVC logotype

Contents of /contributions/modules/views/modules/locale.views.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Mon Feb 23 22:20:04 2009 UTC (9 months ago) by merlinofchaos
Branch: MAIN
CVS Tags: DRUPAL-6--2-7, DRUPAL-6--2-6, DRUPAL-6--2-5, DRUPAL-6--2-4, DRUPAL-6--3-0-ALPHA1, HEAD
Branch point for: DRUPAL-6--2, DRUPAL-6--3, DRUPAL-7--3
File MIME type: text/x-php
Another file I forgot to cvs add from an earlier commit.
1 <?php
2 // $Id: translation.views.inc,v 1.7 2008/12/03 00:25:59 merlinofchaos Exp $
3
4 /**
5 * @file
6 *
7 * Provides views data and handlers for locale.module.
8 */
9
10 /**
11 * @defgroup views_locale_module locale.module handlers
12 *
13 * @{
14 */
15
16 /**
17 * Implementation of hook_views_data().
18 */
19 function locale_views_data() {
20 // Basic table information.
21
22 // Define the base group of this table.
23 $data['locales_source']['table']['group'] = t('Locale source');
24
25 // Advertise this table as a possible base table.
26 $data['locales_source']['table']['base'] = array(
27 'field' => 'lid',
28 'title' => t('Locale source'),
29 'help' => t('A source string for translation, in English or the default site language.'),
30 );
31
32 // lid
33 $data['locales_source']['lid'] = array(
34 'title' => t('LID'),
35 'help' => t('The ID of the source string.'),
36 'field' => array(
37 'handler' => 'views_handler_field',
38 'click sortable' => TRUE,
39 ),
40 'argument' => array(
41 'handler' => 'views_handler_argument_numeric',
42 'numeric' => TRUE,
43 'validate type' => 'lid',
44 ),
45 'filter' => array(
46 'handler' => 'views_handler_filter_numeric',
47 ),
48 'sort' => array(
49 'handler' => 'views_handler_sort',
50 ),
51 );
52
53 // location
54 $data['locales_source']['location'] = array(
55 'group' => t('Locale source'),
56 'title' => t('Location'),
57 'help' => t('A description of the location or context of the string.'),
58 'field' => array(
59 'handler' => 'views_handler_field',
60 'click sortable' => TRUE,
61 ),
62 'sort' => array(
63 'handler' => 'views_handler_sort',
64 ),
65 'filter' => array(
66 'handler' => 'views_handler_filter_string',
67 ),
68 'argument' => array(
69 'handler' => 'views_handler_argument_string',
70 ),
71 );
72
73 // Group field
74 $data['locales_source']['textgroup'] = array(
75 'group' => t('Locale source'),
76 'title' => t('Group'),
77 'help' => t('The group the translation is in.'),
78 'field' => array(
79 'handler' => 'views_handler_field_locale_group',
80 'click sortable' => TRUE,
81 ),
82 'filter' => array(
83 'handler' => 'views_handler_filter_locale_group',
84 ),
85 'argument' => array(
86 'handler' => 'views_handler_argument_locale_group',
87 ),
88 );
89
90 // Source field
91 $data['locales_source']['source'] = array(
92 'group' => t('Locale source'),
93 'title' => t('Source'),
94 'help' => t('The full original string.'),
95 'field' => array(
96 'handler' => 'views_handler_field',
97 ),
98 'filter' => array(
99 'handler' => 'views_handler_filter_string',
100 ),
101 );
102
103 // Version field
104 $data['locales_source']['version'] = array(
105 'group' => t('Locale source'),
106 'title' => t('Version'),
107 'help' => t('The version of Drupal core that this string is for.'),
108 'field' => array(
109 'handler' => 'views_handler_field',
110 'click sortable' => TRUE,
111 ),
112 'filter' => array(
113 'handler' => 'views_handler_filter_locale_version',
114 ),
115 'argument' => array(
116 'handler' => 'views_handler_argument_string',
117 ),
118 );
119
120 $data['locales_source']['edit_lid'] = array(
121 'group' => t('Locale source'),
122 'field' => array(
123 'title' => t('Edit link'),
124 'help' => t('Provide a simple link to edit the translations.'),
125 'handler' => 'views_handler_field_locale_link_edit',
126 ),
127 );
128
129 // ----------------------------------------------------------------------
130 // Locales target table
131
132 // Define the base group of this table. Fields that don't
133 // have a group defined will go into this field by default.
134 $data['locales_target']['table']['group'] = t('Locale target');
135
136 // Join information
137 $data['locales_target']['table']['join'] = array(
138 'locales_source' => array(
139 'left_field' => 'lid',
140 'field' => 'lid',
141 ),
142 );
143
144 // Translation field
145 $data['locales_target']['translation'] = array(
146 'group' => t('Locale target'),
147 'title' => t('Translation'),
148 'help' => t('The full translation string.'),
149 'field' => array(
150 'handler' => 'views_handler_field',
151 ),
152 'filter' => array(
153 'handler' => 'views_handler_filter_string',
154 ),
155 );
156
157 // Language field
158 $data['locales_target']['language'] = array(
159 'group' => t('Locale target'),
160 'title' => t('Language'),
161 'help' => t('The language this translation is in.'),
162 'field' => array(
163 'handler' => 'views_handler_field_locale_language',
164 'click sortable' => TRUE,
165 ),
166 'filter' => array(
167 'handler' => 'views_handler_filter_locale_language',
168 ),
169 'argument' => array(
170 'handler' => 'views_handler_argument_locale_language',
171 ),
172 );
173
174 $data['locales_target']['plid'] = array(
175 'group' => t('Locale target'),
176 'title' => t('Singular LID'),
177 'help' => t('The ID of the parent translation.'),
178 'field' => array(
179 'handler' => 'views_handler_field',
180 ),
181 );
182
183 // Plural
184 $data['locales_target']['plural'] = array(
185 'group' => t('Locale target'),
186 'title' => t('Plural'),
187 'help' => t('Whether or not the translation is plural.'),
188 'field' => array(
189 'handler' => 'views_handler_field_boolean',
190 'click sortable' => TRUE,
191 ),
192 'filter' => array(
193 'handler' => 'views_handler_filter_boolean_operator',
194 'label' => t('Plural'),
195 'type' => 'yes-no',
196 ),
197 'sort' => array(
198 'handler' => 'views_handler_sort',
199 ),
200 );
201
202 return $data;
203 }
204
205 /**
206 * Implementation of hook_views_handlers().
207 */
208 function locale_views_handlers() {
209 return array(
210 'info' => array(
211 'path' => drupal_get_path('module', 'views') . '/modules/locale',
212 ),
213 'handlers' => array(
214 // Field handlers.
215 'views_handler_field_locale_group' => array(
216 'parent' => 'views_handler_field',
217 ),
218 'views_handler_field_locale_language' => array(
219 'parent' => 'views_handler_field',
220 ),
221 'views_handler_field_locale_link_edit' => array(
222 'parent' => 'views_handler_field',
223 ),
224 // Argument handlers.
225 'views_handler_argument_locale_group' => array(
226 'parent' => 'views_handler_argument',
227 ),
228 'views_handler_argument_locale_language' => array(
229 'parent' => 'views_handler_argument',
230 ),
231 // Filters.
232 'views_handler_filter_locale_group' => array(
233 'parent' => 'views_handler_filter_in_operator',
234 ),
235 'views_handler_filter_locale_language' => array(
236 'parent' => 'views_handler_filter_in_operator',
237 ),
238 'views_handler_filter_locale_version' => array(
239 'parent' => 'views_handler_filter_in_operator',
240 ),
241 ),
242 );
243 }
244
245 /**
246 * @}
247 */

  ViewVC Help
Powered by ViewVC 1.1.2