1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Provide views data and handlers for aggregator.module.
|
6
|
*
|
7
|
* @ingroup views_module_handlers
|
8
|
*/
|
9
|
|
10
|
/**
|
11
|
* Implements hook_views_data().
|
12
|
*/
|
13
|
function aggregator_views_data() {
|
14
|
// ----------------------------------------------------------------------
|
15
|
// Main Aggregator Item base table
|
16
|
|
17
|
// Define the base group of this table. Fields that don't
|
18
|
// have a group defined will go into this field by default.
|
19
|
$data['aggregator_item']['table']['group'] = t('Aggregator');
|
20
|
|
21
|
// Advertise this table as a possible base table
|
22
|
$data['aggregator_item']['table']['base'] = array(
|
23
|
'field' => 'iid',
|
24
|
'title' => t('Aggregator item'),
|
25
|
'help' => t("Aggregator items are imported from external RSS and Atom news feeds."),
|
26
|
);
|
27
|
|
28
|
// ----------------------------------------------------------------
|
29
|
// Fields
|
30
|
|
31
|
// item id.
|
32
|
$data['aggregator_item']['iid'] = array(
|
33
|
'title' => t('Feed Item ID'),
|
34
|
'help' => t('The unique ID of the aggregator item.'),
|
35
|
'field' => array(
|
36
|
'handler' => 'views_handler_field_numeric',
|
37
|
'click sortable' => TRUE,
|
38
|
),
|
39
|
'argument' => array(
|
40
|
'handler' => 'views_handler_argument_numeric',
|
41
|
'numeric' => TRUE,
|
42
|
),
|
43
|
'filter' => array(
|
44
|
'handler' => 'views_handler_filter_numeric',
|
45
|
),
|
46
|
'sort' => array(
|
47
|
'handler' => 'views_handler_sort',
|
48
|
),
|
49
|
);
|
50
|
|
51
|
// iid
|
52
|
$data['aggregator_item']['iid'] = array(
|
53
|
'title' => t('Item ID'),
|
54
|
'help' => t('The unique ID of the aggregator item.'), // The help that appears on the UI,
|
55
|
// Information for displaying the iid
|
56
|
'field' => array(
|
57
|
'handler' => 'views_handler_field_numeric',
|
58
|
'click sortable' => TRUE,
|
59
|
),
|
60
|
// Information for accepting a iid as an argument
|
61
|
'argument' => array(
|
62
|
'handler' => 'views_handler_argument_aggregator_iid',
|
63
|
'name field' => 'title', // the field to display in the summary.
|
64
|
'numeric' => TRUE,
|
65
|
),
|
66
|
// Information for accepting a nid as a filter
|
67
|
'filter' => array(
|
68
|
'handler' => 'views_handler_filter_numeric',
|
69
|
),
|
70
|
// Information for sorting on a nid.
|
71
|
'sort' => array(
|
72
|
'handler' => 'views_handler_sort',
|
73
|
),
|
74
|
);
|
75
|
|
76
|
// title
|
77
|
$data['aggregator_item']['title'] = array(
|
78
|
'title' => t('Title'), // The item it appears as on the UI,
|
79
|
'help' => t('The title of the aggregator item.'),
|
80
|
// Information for displaying a title as a field
|
81
|
'field' => array(
|
82
|
'handler' => 'views_handler_field_aggregator_title_link',
|
83
|
'extra' => array('link'),
|
84
|
'click sortable' => TRUE,
|
85
|
),
|
86
|
'sort' => array(
|
87
|
'handler' => 'views_handler_sort',
|
88
|
),
|
89
|
// Information for accepting a title as a filter
|
90
|
'filter' => array(
|
91
|
'handler' => 'views_handler_filter_string',
|
92
|
),
|
93
|
);
|
94
|
|
95
|
// link
|
96
|
$data['aggregator_item']['link'] = array(
|
97
|
'title' => t('Link'), // The item it appears as on the UI,
|
98
|
'help' => t('The link to the original source URL of the item.'),
|
99
|
'field' => array(
|
100
|
'handler' => 'views_handler_field_url',
|
101
|
'click sortable' => TRUE,
|
102
|
),
|
103
|
'sort' => array(
|
104
|
'handler' => 'views_handler_sort',
|
105
|
),
|
106
|
// Information for accepting a title as a filter
|
107
|
'filter' => array(
|
108
|
'handler' => 'views_handler_filter_string',
|
109
|
),
|
110
|
);
|
111
|
|
112
|
// author
|
113
|
$data['aggregator_item']['author'] = array(
|
114
|
'title' => t('Author'), // The item it appears as on the UI,
|
115
|
'help' => t('The author of the original imported item.'),
|
116
|
// Information for displaying a title as a field
|
117
|
'field' => array(
|
118
|
'handler' => 'views_handler_field_aggregator_xss',
|
119
|
'click sortable' => TRUE,
|
120
|
),
|
121
|
'sort' => array(
|
122
|
'handler' => 'views_handler_sort',
|
123
|
),
|
124
|
// Information for accepting a title as a filter
|
125
|
'filter' => array(
|
126
|
'handler' => 'views_handler_filter_string',
|
127
|
),
|
128
|
'argument' => array(
|
129
|
'handler' => 'views_handler_argument_string',
|
130
|
),
|
131
|
);
|
132
|
|
133
|
// guid
|
134
|
$data['aggregator_item']['guid'] = array(
|
135
|
'title' => t('GUID'), // The item it appears as on the UI,
|
136
|
'help' => t('The guid of the original imported item.'),
|
137
|
// Information for displaying a title as a field
|
138
|
'field' => array(
|
139
|
'handler' => 'views_handler_field_xss',
|
140
|
'click sortable' => TRUE,
|
141
|
),
|
142
|
'sort' => array(
|
143
|
'handler' => 'views_handler_sort',
|
144
|
),
|
145
|
// Information for accepting a title as a filter
|
146
|
'filter' => array(
|
147
|
'handler' => 'views_handler_filter_string',
|
148
|
),
|
149
|
'argument' => array(
|
150
|
'handler' => 'views_handler_argument_string',
|
151
|
),
|
152
|
);
|
153
|
|
154
|
// feed body
|
155
|
$data['aggregator_item']['description'] = array(
|
156
|
'title' => t('Body'), // The item it appears as on the UI,
|
157
|
'help' => t('The actual content of the imported item.'),
|
158
|
// Information for displaying a title as a field
|
159
|
'field' => array(
|
160
|
'handler' => 'views_handler_field_aggregator_xss',
|
161
|
'click sortable' => FALSE,
|
162
|
),
|
163
|
// Information for accepting a title as a filter
|
164
|
'filter' => array(
|
165
|
'handler' => 'views_handler_filter_string',
|
166
|
),
|
167
|
);
|
168
|
|
169
|
// item timestamp
|
170
|
$data['aggregator_item']['timestamp'] = array(
|
171
|
'title' => t('Timestamp'), // The item it appears as on the UI,
|
172
|
'help' => t('The date the original feed item was posted. (With some feeds, this will be the date it was imported.)'),
|
173
|
// Information for displaying a title as a field
|
174
|
'field' => array(
|
175
|
'handler' => 'views_handler_field_date',
|
176
|
'click sortable' => TRUE,
|
177
|
),
|
178
|
'sort' => array(
|
179
|
'handler' => 'views_handler_sort_date',
|
180
|
),
|
181
|
// Information for accepting a title as a filter
|
182
|
'filter' => array(
|
183
|
'handler' => 'views_handler_filter_date',
|
184
|
),
|
185
|
'argument' => array(
|
186
|
'handler' => 'views_handler_argument_date',
|
187
|
),
|
188
|
);
|
189
|
|
190
|
|
191
|
// ----------------------------------------------------------------------
|
192
|
// Aggregator feed table
|
193
|
|
194
|
$data['aggregator_feed']['table']['group'] = t('Aggregator feed');
|
195
|
|
196
|
// Explain how this table joins to others.
|
197
|
$data['aggregator_feed']['table']['join'] = array(
|
198
|
'aggregator_item' => array(
|
199
|
'left_field' => 'fid',
|
200
|
'field' => 'fid',
|
201
|
),
|
202
|
);
|
203
|
|
204
|
// fid
|
205
|
$data['aggregator_feed']['fid'] = array(
|
206
|
'title' => t('Feed ID'),
|
207
|
'help' => t('The unique ID of the aggregator feed.'), // The help that appears on the UI,
|
208
|
// Information for displaying the fid
|
209
|
'field' => array(
|
210
|
'handler' => 'views_handler_field_numeric',
|
211
|
'click sortable' => TRUE,
|
212
|
),
|
213
|
// Information for accepting a fid as an argument
|
214
|
'argument' => array(
|
215
|
'handler' => 'views_handler_argument_aggregator_fid',
|
216
|
'name field' => 'title', // the field to display in the summary.
|
217
|
'numeric' => TRUE,
|
218
|
),
|
219
|
// Information for accepting a nid as a filter
|
220
|
'filter' => array(
|
221
|
'handler' => 'views_handler_filter_numeric',
|
222
|
),
|
223
|
// Information for sorting on a fid.
|
224
|
'sort' => array(
|
225
|
'handler' => 'views_handler_sort',
|
226
|
),
|
227
|
);
|
228
|
|
229
|
// title
|
230
|
$data['aggregator_feed']['title'] = array(
|
231
|
'title' => t('Title'), // The item it appears as on the UI,
|
232
|
'help' => t('The title of the aggregator feed.'),
|
233
|
// Information for displaying a title as a field
|
234
|
'field' => array(
|
235
|
'handler' => 'views_handler_field_aggregator_title_link',
|
236
|
'extra' => array('link'),
|
237
|
'click sortable' => TRUE,
|
238
|
),
|
239
|
'sort' => array(
|
240
|
'handler' => 'views_handler_sort',
|
241
|
),
|
242
|
// Information for accepting a title as a filter
|
243
|
'filter' => array(
|
244
|
'handler' => 'views_handler_filter_string',
|
245
|
),
|
246
|
'argument' => array(
|
247
|
'handler' => 'views_handler_argument_string',
|
248
|
),
|
249
|
);
|
250
|
|
251
|
// link
|
252
|
$data['aggregator_feed']['link'] = array(
|
253
|
'title' => t('Link'), // The item it appears as on the UI,
|
254
|
'help' => t('The link to the source URL of the feed.'),
|
255
|
// Information for displaying a title as a field
|
256
|
'field' => array(
|
257
|
'handler' => 'views_handler_field_url',
|
258
|
'click sortable' => TRUE,
|
259
|
),
|
260
|
'sort' => array(
|
261
|
'handler' => 'views_handler_sort',
|
262
|
),
|
263
|
'filter' => array(
|
264
|
'handler' => 'views_handler_filter_string',
|
265
|
),
|
266
|
);
|
267
|
|
268
|
// feed last updated
|
269
|
$data['aggregator_feed']['checked'] = array(
|
270
|
'title' => t('Last checked'), // The item it appears as on the UI,
|
271
|
'help' => t('The date the feed was last checked for new content.'),
|
272
|
// Information for displaying a title as a field
|
273
|
'field' => array(
|
274
|
'handler' => 'views_handler_field_date',
|
275
|
'click sortable' => TRUE,
|
276
|
),
|
277
|
'sort' => array(
|
278
|
'handler' => 'views_handler_sort_date',
|
279
|
),
|
280
|
'filter' => array(
|
281
|
'handler' => 'views_handler_filter_date',
|
282
|
),
|
283
|
'argument' => array(
|
284
|
'handler' => 'views_handler_argument_date',
|
285
|
),
|
286
|
);
|
287
|
|
288
|
// feed description
|
289
|
$data['aggregator_feed']['description'] = array(
|
290
|
'title' => t('Description'), // The item it appears as on the UI,
|
291
|
'help' => t('The description of the aggregator feed.'),
|
292
|
// Information for displaying a title as a field
|
293
|
'field' => array(
|
294
|
'handler' => 'views_handler_field_xss',
|
295
|
'click sortable' => FALSE,
|
296
|
),
|
297
|
'filter' => array(
|
298
|
'handler' => 'views_handler_filter_string',
|
299
|
),
|
300
|
);
|
301
|
|
302
|
// feed last updated
|
303
|
$data['aggregator_feed']['modified'] = array(
|
304
|
'title' => t('Last modified'), // The item it appears as on the UI,
|
305
|
'help' => t('The date of the most recent new content on the feed.'),
|
306
|
// Information for displaying a title as a field
|
307
|
'field' => array(
|
308
|
'handler' => 'views_handler_field_date',
|
309
|
'click sortable' => TRUE,
|
310
|
),
|
311
|
'sort' => array(
|
312
|
'handler' => 'views_handler_sort_date',
|
313
|
),
|
314
|
// Information for accepting a title as a filter
|
315
|
'filter' => array(
|
316
|
'handler' => 'views_handler_filter_date',
|
317
|
),
|
318
|
'argument' => array(
|
319
|
'handler' => 'views_handler_argument_date',
|
320
|
),
|
321
|
);
|
322
|
|
323
|
// ----------------------------------------------------------------------
|
324
|
// Aggregator category feed table
|
325
|
|
326
|
$data['aggregator_category_feed']['table']['join'] = array(
|
327
|
'aggregator_item' => array(
|
328
|
'left_field' => 'fid',
|
329
|
'field' => 'fid',
|
330
|
),
|
331
|
);
|
332
|
|
333
|
// ----------------------------------------------------------------------
|
334
|
// Aggregator category table
|
335
|
|
336
|
$data['aggregator_category']['table']['group'] = t('Aggregator category');
|
337
|
|
338
|
$data['aggregator_category']['table']['join'] = array(
|
339
|
'aggregator_item' => array(
|
340
|
'left_table' => 'aggregator_category_feed',
|
341
|
'left_field' => 'cid',
|
342
|
'field' => 'cid',
|
343
|
),
|
344
|
);
|
345
|
|
346
|
// cid
|
347
|
$data['aggregator_category']['cid'] = array(
|
348
|
'title' => t('Category ID'),
|
349
|
'help' => t('The unique ID of the aggregator category.'),
|
350
|
'field' => array(
|
351
|
'handler' => 'views_handler_field_numeric',
|
352
|
'click sortable' => TRUE,
|
353
|
),
|
354
|
'argument' => array(
|
355
|
'handler' => 'views_handler_argument_aggregator_category_cid',
|
356
|
'name field' => 'title',
|
357
|
'numeric' => TRUE,
|
358
|
),
|
359
|
'filter' => array(
|
360
|
'handler' => 'views_handler_filter_aggregator_category_cid',
|
361
|
),
|
362
|
'sort' => array(
|
363
|
'handler' => 'views_handler_sort',
|
364
|
),
|
365
|
);
|
366
|
|
367
|
// title
|
368
|
$data['aggregator_category']['title'] = array(
|
369
|
'title' => t('Category'),
|
370
|
'help' => t('The title of the aggregator category.'),
|
371
|
'field' => array(
|
372
|
'handler' => 'views_handler_field_aggregator_category',
|
373
|
'click sortable' => TRUE,
|
374
|
),
|
375
|
'sort' => array(
|
376
|
'handler' => 'views_handler_sort',
|
377
|
),
|
378
|
'filter' => array(
|
379
|
'handler' => 'views_handler_filter_string',
|
380
|
),
|
381
|
);
|
382
|
|
383
|
return $data;
|
384
|
}
|
385
|
|
386
|
/**
|
387
|
* Implements hook_views_plugins().
|
388
|
*/
|
389
|
function aggregator_views_plugins() {
|
390
|
return array(
|
391
|
'module' => 'views', // This just tells our themes are elsewhere.
|
392
|
'row' => array(
|
393
|
'aggregator_rss' => array(
|
394
|
'title' => t('Aggregator item'),
|
395
|
'help' => t('Display the aggregator item using the data from the original source.'),
|
396
|
'handler' => 'views_plugin_row_aggregator_rss',
|
397
|
'path' => drupal_get_path('module', 'views') . '/modules/node', // not necessary for most modules
|
398
|
'theme' => 'views_view_row_rss',
|
399
|
'base' => array('aggregator_item'), // only works with 'node' as base.
|
400
|
'uses options' => TRUE,
|
401
|
'type' => 'feed',
|
402
|
'help topic' => 'style-aggregator-rss',
|
403
|
),
|
404
|
),
|
405
|
);
|
406
|
}
|