aggregator.views.inc

  1. cis7 sites/all/modules/ulmus/views/modules/aggregator.views.inc
  2. cle7 sites/all/modules/ulmus/views/modules/aggregator.views.inc
  3. ecd7 sites/all/modules/ulmus/views/modules/aggregator.views.inc
  4. elmsmedia7 sites/all/modules/ulmus/views/modules/aggregator.views.inc
  5. harmony7 sites/all/modules/ulmus/views/modules/aggregator.views.inc
  6. icor7 sites/all/modules/ulmus/views/modules/aggregator.views.inc
  7. meedjum_blog7 sites/all/modules/ulmus/views/modules/aggregator.views.inc
  8. mooc7 sites/all/modules/ulmus/views/modules/aggregator.views.inc

Provide views data and handlers for aggregator.module.

Functions

File

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

Related topics