5 * Provide views data and handlers for aggregator.module.
7 * @ingroup views_module_handlers
11 * Implements hook_views_data().
13 function aggregator_views_data() {
14 // ----------------------------------------------------------------------
15 // Main Aggregator Item base table
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');
21 // Advertise this table as a possible base table
22 $data['aggregator_item']['table']['base'] = array(
24 'title' => t('Aggregator item'),
25 'help' => t("Aggregator items are imported from external RSS and Atom news feeds."),
28 // ----------------------------------------------------------------
32 $data['aggregator_item']['iid'] = array(
33 'title' => t('Feed Item ID'),
34 'help' => t('The unique ID of the aggregator item.'),
36 'handler' => 'views_handler_field_numeric',
37 'click sortable' => TRUE,
40 'handler' => 'views_handler_argument_numeric',
44 'handler' => 'views_handler_filter_numeric',
47 'handler' => 'views_handler_sort',
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
57 'handler' => 'views_handler_field_numeric',
58 'click sortable' => TRUE,
60 // Information for accepting a iid as an argument
62 'handler' => 'views_handler_argument_aggregator_iid',
63 'name field' => 'title', // the field to display in the summary.
66 // Information for accepting a nid as a filter
68 'handler' => 'views_handler_filter_numeric',
70 // Information for sorting on a nid.
72 'handler' => 'views_handler_sort',
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
82 'handler' => 'views_handler_field_aggregator_title_link',
83 'extra' => array('link'),
84 'click sortable' => TRUE,
87 'handler' => 'views_handler_sort',
89 // Information for accepting a title as a filter
91 'handler' => 'views_handler_filter_string',
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.'),
100 'handler' => 'views_handler_field_url',
101 'click sortable' => TRUE,
104 'handler' => 'views_handler_sort',
106 // Information for accepting a title as a filter
108 'handler' => 'views_handler_filter_string',
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
118 'handler' => 'views_handler_field_aggregator_xss',
119 'click sortable' => TRUE,
122 'handler' => 'views_handler_sort',
124 // Information for accepting a title as a filter
126 'handler' => 'views_handler_filter_string',
129 'handler' => 'views_handler_argument_string',
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
139 'handler' => 'views_handler_field_xss',
140 'click sortable' => TRUE,
143 'handler' => 'views_handler_sort',
145 // Information for accepting a title as a filter
147 'handler' => 'views_handler_filter_string',
150 'handler' => 'views_handler_argument_string',
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
160 'handler' => 'views_handler_field_aggregator_xss',
161 'click sortable' => FALSE,
163 // Information for accepting a title as a filter
165 'handler' => 'views_handler_filter_string',
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
175 'handler' => 'views_handler_field_date',
176 'click sortable' => TRUE,
179 'handler' => 'views_handler_sort_date',
181 // Information for accepting a title as a filter
183 'handler' => 'views_handler_filter_date',
186 'handler' => 'views_handler_argument_date',
191 // ----------------------------------------------------------------------
192 // Aggregator feed table
194 $data['aggregator_feed']['table']['group'] = t('Aggregator feed');
196 // Explain how this table joins to others.
197 $data['aggregator_feed']['table']['join'] = array(
198 'aggregator_item' => array(
199 'left_field' => '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
210 'handler' => 'views_handler_field_numeric',
211 'click sortable' => TRUE,
213 // Information for accepting a fid as an argument
215 'handler' => 'views_handler_argument_aggregator_fid',
216 'name field' => 'title', // the field to display in the summary.
219 // Information for accepting a nid as a filter
221 'handler' => 'views_handler_filter_numeric',
223 // Information for sorting on a fid.
225 'handler' => 'views_handler_sort',
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
235 'handler' => 'views_handler_field_aggregator_title_link',
236 'extra' => array('link'),
237 'click sortable' => TRUE,
240 'handler' => 'views_handler_sort',
242 // Information for accepting a title as a filter
244 'handler' => 'views_handler_filter_string',
247 'handler' => 'views_handler_argument_string',
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
257 'handler' => 'views_handler_field_url',
258 'click sortable' => TRUE,
261 'handler' => 'views_handler_sort',
264 'handler' => 'views_handler_filter_string',
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
274 'handler' => 'views_handler_field_date',
275 'click sortable' => TRUE,
278 'handler' => 'views_handler_sort_date',
281 'handler' => 'views_handler_filter_date',
284 'handler' => 'views_handler_argument_date',
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
294 'handler' => 'views_handler_field_xss',
295 'click sortable' => FALSE,
298 'handler' => 'views_handler_filter_string',
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
308 'handler' => 'views_handler_field_date',
309 'click sortable' => TRUE,
312 'handler' => 'views_handler_sort_date',
314 // Information for accepting a title as a filter
316 'handler' => 'views_handler_filter_date',
319 'handler' => 'views_handler_argument_date',
323 // ----------------------------------------------------------------------
324 // Aggregator category feed table
326 $data['aggregator_category_feed']['table']['join'] = array(
327 'aggregator_item' => array(
328 'left_field' => 'fid',
333 // ----------------------------------------------------------------------
334 // Aggregator category table
336 $data['aggregator_category']['table']['group'] = t('Aggregator category');
338 $data['aggregator_category']['table']['join'] = array(
339 'aggregator_item' => array(
340 'left_table' => 'aggregator_category_feed',
341 'left_field' => 'cid',
347 $data['aggregator_category']['cid'] = array(
348 'title' => t('Category ID'),
349 'help' => t('The unique ID of the aggregator category.'),
351 'handler' => 'views_handler_field_numeric',
352 'click sortable' => TRUE,
355 'handler' => 'views_handler_argument_aggregator_category_cid',
356 'name field' => 'title',
360 'handler' => 'views_handler_filter_aggregator_category_cid',
363 'handler' => 'views_handler_sort',
368 $data['aggregator_category']['title'] = array(
369 'title' => t('Category'),
370 'help' => t('The title of the aggregator category.'),
372 'handler' => 'views_handler_field_aggregator_category',
373 'click sortable' => TRUE,
376 'handler' => 'views_handler_sort',
379 'handler' => 'views_handler_filter_string',
387 * Implements hook_views_plugins().
389 function aggregator_views_plugins() {
391 'module' => 'views', // This just tells our themes are elsewhere.
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,
402 'help topic' => 'style-aggregator-rss',