• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List
  • File Members

modules/aggregator.views.inc

Go to the documentation of this file.
00001 <?php
00019 function aggregator_views_data() {
00020   // ----------------------------------------------------------------------
00021   // Main Aggregator Item base table
00022 
00023   // Define the base group of this table. Fields that don't
00024   // have a group defined will go into this field by default.
00025   $data['aggregator_item']['table']['group']  = t('Aggregator');
00026 
00027   // Advertise this table as a possible base table
00028   $data['aggregator_item']['table']['base'] = array(
00029     'field' => 'iid',
00030     'title' => t('Aggregator item'),
00031     'help' => t("Aggregator items are imported from external RSS and Atom news feeds."),
00032   );
00033 
00034   // ----------------------------------------------------------------
00035   // Fields
00036 
00037   // item id.
00038   $data['aggregator_item']['iid'] = array(
00039     'title' => t('Feed Item ID'),
00040     'help' => t('The unique ID of the aggregator item.'),
00041     'field' => array(
00042       'handler' => 'views_handler_field_numeric',
00043       'click sortable' => TRUE,
00044     ),
00045     'argument' => array(
00046       'handler' => 'views_handler_argument_numeric',
00047       'numeric' => TRUE,
00048     ),
00049     'filter' => array(
00050       'handler' => 'views_handler_filter_numeric',
00051     ),
00052     'sort' => array(
00053       'handler' => 'views_handler_sort',
00054     ),
00055   );
00056 
00057   // iid
00058   $data['aggregator_item']['iid'] = array(
00059     'title' => t('Item ID'),
00060     'help' => t('The unique ID of the aggregator item.'), // The help that appears on the UI,
00061     // Information for displaying the iid
00062     'field' => array(
00063       'handler' => 'views_handler_field_numeric',
00064       'click sortable' => TRUE,
00065     ),
00066     // Information for accepting a iid as an argument
00067     'argument' => array(
00068       'handler' => 'views_handler_argument_aggregator_iid',
00069       'name field' => 'title', // the field to display in the summary.
00070       'numeric' => TRUE,
00071     ),
00072     // Information for accepting a nid as a filter
00073     'filter' => array(
00074       'handler' => 'views_handler_filter_numeric',
00075     ),
00076     // Information for sorting on a nid.
00077     'sort' => array(
00078       'handler' => 'views_handler_sort',
00079     ),
00080   );
00081 
00082   // title
00083   $data['aggregator_item']['title'] = array(
00084     'title' => t('Title'), // The item it appears as on the UI,
00085     'help' => t('The title of the aggregator item.'),
00086      // Information for displaying a title as a field
00087     'field' => array(
00088       'handler' => 'views_handler_field_aggregator_title_link',
00089       'extra' => array('link'),
00090       'click sortable' => TRUE,
00091      ),
00092     'sort' => array(
00093       'handler' => 'views_handler_sort',
00094     ),
00095     // Information for accepting a title as a filter
00096     'filter' => array(
00097       'handler' => 'views_handler_filter_string',
00098     ),
00099   );
00100 
00101   // link
00102   $data['aggregator_item']['link'] = array(
00103     'title' => t('Link'), // The item it appears as on the UI,
00104     'help' => t('The link to the original source URL of the item.'),
00105     'field' => array(
00106       'handler' => 'views_handler_field_url',
00107       'click sortable' => TRUE,
00108      ),
00109     'sort' => array(
00110       'handler' => 'views_handler_sort',
00111     ),
00112     // Information for accepting a title as a filter
00113     'filter' => array(
00114       'handler' => 'views_handler_filter_string',
00115     ),
00116   );
00117 
00118   // author
00119   $data['aggregator_item']['author'] = array(
00120     'title' => t('Author'), // The item it appears as on the UI,
00121     'help' => t('The author of the original imported item.'),
00122      // Information for displaying a title as a field
00123     'field' => array(
00124       'handler' => 'views_handler_field_aggregator_xss',
00125       'click sortable' => TRUE,
00126      ),
00127     'sort' => array(
00128       'handler' => 'views_handler_sort',
00129     ),
00130     // Information for accepting a title as a filter
00131     'filter' => array(
00132       'handler' => 'views_handler_filter_string',
00133     ),
00134     'argument' => array(
00135       'handler' => 'views_handler_argument_string',
00136     ),
00137   );
00138 
00139   // guid
00140   $data['aggregator_item']['guid'] = array(
00141     'title' => t('GUID'), // The item it appears as on the UI,
00142     'help' => t('The guid of the original imported item.'),
00143      // Information for displaying a title as a field
00144     'field' => array(
00145       'handler' => 'views_handler_field_xss',
00146       'click sortable' => TRUE,
00147      ),
00148     'sort' => array(
00149       'handler' => 'views_handler_sort',
00150     ),
00151     // Information for accepting a title as a filter
00152     'filter' => array(
00153       'handler' => 'views_handler_filter_string',
00154     ),
00155     'argument' => array(
00156       'handler' => 'views_handler_argument_string',
00157     ),
00158   );
00159 
00160   // feed body
00161   $data['aggregator_item']['description'] = array(
00162     'title' => t('Body'), // The item it appears as on the UI,
00163     'help' => t('The actual content of the imported item.'),
00164      // Information for displaying a title as a field
00165     'field' => array(
00166       'handler' => 'views_handler_field_aggregator_xss',
00167       'click sortable' => FALSE,
00168      ),
00169     // Information for accepting a title as a filter
00170     'filter' => array(
00171       'handler' => 'views_handler_filter_string',
00172     ),
00173   );
00174 
00175   // item timestamp
00176   $data['aggregator_item']['timestamp'] = array(
00177     'title' => t('Timestamp'), // The item it appears as on the UI,
00178     'help' => t('The date the original feed item was posted. (With some feeds, this will be the date it was imported.)'),
00179      // Information for displaying a title as a field
00180     'field' => array(
00181       'handler' => 'views_handler_field_date',
00182       'click sortable' => TRUE,
00183      ),
00184     'sort' => array(
00185       'handler' => 'views_handler_sort_date',
00186     ),
00187     // Information for accepting a title as a filter
00188     'filter' => array(
00189       'handler' => 'views_handler_filter_date',
00190     ),
00191     'argument' => array(
00192       'handler' => 'views_handler_argument_date',
00193     ),
00194   );
00195 
00196 
00197   // ----------------------------------------------------------------------
00198   // Aggregator feed table
00199 
00200   $data['aggregator_feed']['table']['group']  = t('Aggregator feed');
00201 
00202   // Explain how this table joins to others.
00203   $data['aggregator_feed']['table']['join'] = array(
00204     'aggregator_item' => array(
00205       'left_field' => 'fid',
00206       'field' => 'fid',
00207     ),
00208   );
00209 
00210   // fid
00211   $data['aggregator_feed']['fid'] = array(
00212     'title' => t('Feed ID'),
00213     'help' => t('The unique ID of the aggregator feed.'), // The help that appears on the UI,
00214     // Information for displaying the fid
00215     'field' => array(
00216       'handler' => 'views_handler_field_numeric',
00217       'click sortable' => TRUE,
00218     ),
00219     // Information for accepting a fid as an argument
00220     'argument' => array(
00221       'handler' => 'views_handler_argument_aggregator_fid',
00222       'name field' => 'title', // the field to display in the summary.
00223       'numeric' => TRUE,
00224     ),
00225     // Information for accepting a nid as a filter
00226     'filter' => array(
00227       'handler' => 'views_handler_filter_numeric',
00228     ),
00229     // Information for sorting on a fid.
00230     'sort' => array(
00231       'handler' => 'views_handler_sort',
00232     ),
00233   );
00234 
00235   // title
00236   $data['aggregator_feed']['title'] = array(
00237     'title' => t('Title'), // The item it appears as on the UI,
00238     'help' => t('The title of the aggregator feed.'),
00239      // Information for displaying a title as a field
00240     'field' => array(
00241       'handler' => 'views_handler_field_aggregator_title_link',
00242       'extra' => array('link'),
00243       'click sortable' => TRUE,
00244      ),
00245     'sort' => array(
00246       'handler' => 'views_handler_sort',
00247     ),
00248     // Information for accepting a title as a filter
00249     'filter' => array(
00250       'handler' => 'views_handler_filter_string',
00251     ),
00252   );
00253 
00254   // link
00255   $data['aggregator_feed']['link'] = array(
00256     'title' => t('Link'), // The item it appears as on the UI,
00257     'help' => t('The link to the source URL of the feed.'),
00258      // Information for displaying a title as a field
00259     'field' => array(
00260       'handler' => 'views_handler_field_url',
00261       'click sortable' => TRUE,
00262      ),
00263     'sort' => array(
00264       'handler' => 'views_handler_sort',
00265     ),
00266     // Information for accepting a title as a filter
00267     'filter' => array(
00268       'handler' => 'views_handler_filter_string',
00269     ),
00270   );
00271 
00272   // feed last updated
00273   $data['aggregator_feed']['checked'] = array(
00274     'title' => t('Last checked'), // The item it appears as on the UI,
00275     'help' => t('The date the feed was last checked for new content.'),
00276      // Information for displaying a title as a field
00277     'field' => array(
00278       'handler' => 'views_handler_field_date',
00279       'click sortable' => TRUE,
00280      ),
00281     'sort' => array(
00282       'handler' => 'views_handler_sort_date',
00283     ),
00284     // Information for accepting a title as a filter
00285     'filter' => array(
00286       'handler' => 'views_handler_filter_date',
00287     ),
00288     'argument' => array(
00289       'handler' => 'views_handler_argument_date',
00290     ),
00291   );
00292 
00293   // feed description
00294   $data['aggregator_feed']['description'] = array(
00295     'title' => t('Description'), // The item it appears as on the UI,
00296     'help' => t('The description of the aggregator feed.'),
00297      // Information for displaying a title as a field
00298     'field' => array(
00299       'handler' => 'views_handler_field_xss',
00300       'click sortable' => FALSE,
00301      ),
00302     // Information for accepting a title as a filter
00303     'filter' => array(
00304       'handler' => 'views_handler_filter_string',
00305     ),
00306   );
00307 
00308   // feed last updated
00309   $data['aggregator_feed']['modified'] = array(
00310     'title' => t('Last modified'), // The item it appears as on the UI,
00311     'help' => t('The date of the most recent new content on the feed.'),
00312      // Information for displaying a title as a field
00313     'field' => array(
00314       'handler' => 'views_handler_field_date',
00315       'click sortable' => TRUE,
00316      ),
00317     'sort' => array(
00318       'handler' => 'views_handler_sort_date',
00319     ),
00320     // Information for accepting a title as a filter
00321     'filter' => array(
00322       'handler' => 'views_handler_filter_date',
00323     ),
00324     'argument' => array(
00325       'handler' => 'views_handler_argument_date',
00326     ),
00327   );
00328 
00329   // ----------------------------------------------------------------------
00330   // Aggregator category feed table
00331 
00332   $data['aggregator_category_feed']['table']['join'] = array(
00333     'aggregator_item' => array(
00334       'left_field' => 'fid',
00335       'field' => 'fid',
00336     ),
00337   );
00338 
00339   // ----------------------------------------------------------------------
00340   // Aggregator category table
00341 
00342   $data['aggregator_category']['table']['group'] = t('Aggregator category');
00343 
00344   $data['aggregator_category']['table']['join'] = array(
00345     'aggregator_item' => array(
00346       'left_table' => 'aggregator_category_feed',
00347       'left_field' => 'cid',
00348       'field' => 'cid',
00349     ),
00350   );
00351 
00352   // cid
00353   $data['aggregator_category']['cid'] = array(
00354     'title' => t('Category ID'),
00355     'help' => t('The unique ID of the aggregator category.'),
00356     'field' => array(
00357       'handler' => 'views_handler_field_numeric',
00358       'click sortable' => TRUE,
00359     ),
00360     'argument' => array(
00361       'handler' => 'views_handler_argument_aggregator_category_cid',
00362       'name field' => 'title',
00363       'numeric' => TRUE,
00364     ),
00365     'filter' => array(
00366       'handler' => 'views_handler_filter_aggregator_category_cid',
00367     ),
00368     'sort' => array(
00369       'handler' => 'views_handler_sort',
00370     ),
00371   );
00372 
00373   // title
00374   $data['aggregator_category']['title'] = array(
00375     'title' => t('Category'),
00376     'help' => t('The title of the aggregator category.'),
00377     'field' => array(
00378       'handler' => 'views_handler_field_aggregator_category',
00379       'click sortable' => TRUE,
00380      ),
00381     'sort' => array(
00382       'handler' => 'views_handler_sort',
00383     ),
00384     'filter' => array(
00385       'handler' => 'views_handler_filter_string',
00386     ),
00387   );
00388 
00389   return $data;
00390 }
00391 
00395 function aggregator_views_plugins() {
00396   return array(
00397     'module' => 'views', // This just tells our themes are elsewhere.
00398     'row' => array(
00399       'aggregator_rss' => array(
00400         'title' => t('Aggregator item'),
00401         'help' => t('Display the aggregator item using the data from the original source.'),
00402         'handler' => 'views_plugin_row_aggregator_rss',
00403         'path' => drupal_get_path('module', 'views') . '/modules/node', // not necessary for most modules
00404         'theme' => 'views_view_row_rss',
00405         'base' => array('aggregator_item'), // only works with 'node' as base.
00406         'uses options' => TRUE,
00407         'type' => 'feed',
00408         'help topic' => 'style-aggregator-rss',
00409       ),
00410     ),
00411   );
00412 }

Generated on Sun Feb 26 2012 12:52:51 for Views by  doxygen 1.7.1