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

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

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


Revision 1.1 - (show annotations) (download) (as text)
Sun Sep 14 17:54:42 2008 UTC (14 months, 1 week ago) by kbahey
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-6--1
File MIME type: text/x-php
#308349 by blackdog, Views 2.x integration for D6 version of favorite nodes.
1 <?php
2 /**
3 * Implementation of hook_views_handlers().
4 */
5 function favorite_nodes_views_handlers() {
6 return array(
7 'info' => array(
8 'path' => drupal_get_path('module', 'favorite_nodes') .'/includes',
9 ),
10 'handlers' => array(
11 /*'favorite_nodes_handler_argument_uid' => array(
12 'parent' => 'views_handler_argument_numeric',
13 ),*/
14 'favorite_nodes_handler_user_count' => array(
15 'parent' => 'views_handler_field',
16 ),
17 ),
18 );
19 }
20
21 /**
22 * Implementation of hook_views_data().
23 */
24 function favorite_nodes_views_data() {
25 $data['favorite_nodes']['table']['group'] = t('Favorite Nodes');
26
27 $data['favorite_nodes']['table']['join'] = array(
28 'node' => array(
29 'field' => 'nid',
30 'left_field' => 'nid',
31 ),
32 'users' => array(
33 'field' => 'uid',
34 'left_field' => 'uid',
35 ),
36 );
37
38 $data['favorite_nodes']['last'] = array(
39 'title' => t('Time Added'),
40 'help' => t('Display the date/time the favorite node was added.'),
41 'field' => array(
42 'handler' => 'views_handler_field_date',
43 'click sortable' => TRUE,
44 ),
45 'sort' => array(
46 'handler' => 'views_handler_sort',
47 ),
48 'filter' => array(
49 'handler' => 'views_handler_filter_date',
50 'help' => t('This filter allows favorite nodes to be filtered by the date and time the user added them. Enter dates in the format: CCYY-MM-DD HH:MM:SS. Enter \'now\' to use the current time. You may enter a delta (in seconds) to the option that will be added to the time; this is most useful when combined with now.'),
51 ),
52 );
53
54 $data['favorite_nodes']['count'] = array(
55 'title' => t('Count'),
56 'help' => t('Number of times this node was added to favorites by any user.'),
57 'real field' => 'nid',
58 'field' => array(
59 'handler' => 'favorite_nodes_handler_user_count',
60 'click sortable' => FALSE,
61 ),
62 );
63
64 $data['favorite_nodes']['uid'] = array(
65 'title' => t('User ID'),
66 'help' => t('This allows you to filter based on favorites nodes.'),
67 'filter' => array(
68 'handler' => 'views_handler_filter_user_current',
69 ),
70 'argument' => array(
71 // use favorite nodes handler?
72 'handler' => 'views_handler_argument_numeric',
73 ),
74 );
75
76 return $data;
77 }

  ViewVC Help
Powered by ViewVC 1.1.2