/[drupal]/contributions/modules/twitter/twitter.views_default.inc
ViewVC logotype

Contents of /contributions/modules/twitter/twitter.views_default.inc

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


Revision 1.1 - (show annotations) (download) (as text)
Wed Jun 18 03:34:33 2008 UTC (17 months, 1 week ago) by eaton
Branch: MAIN
CVS Tags: DRUPAL-6--2-5, DRUPAL-6--2-4, DRUPAL-6--2-3, DRUPAL-6--2-2, DRUPAL-6--2-1, DRUPAL-6--2-0, HEAD
Branch point for: DRUPAL-6--2, DRUPAL-6--3
File MIME type: text/x-php
Some additional changes to the API before a real 6.x release is rolled, including more extensive PHPDoc for all the public functions. Full Views2 integration, with a handy default view that shows latest tweets by the author of the current node. Freakin Twitter, man.
1 <?php
2 // $Id$
3
4 function twitter_views_default_views() {
5 $view = new view;
6 $view->name = 'tweets';
7 $view->description = 'Displays Twitter.com status messages for users who have associated Twitter accounts.';
8 $view->tag = '';
9 $view->view_php = '';
10 $view->base_table = 'twitter';
11 $view->is_cacheable = '0';
12 $view->api_version = 2;
13 $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
14 $handler = $view->new_display('default', 'Tweets', 'default');
15 $handler->override_option('fields', array(
16 'profile_image_url' => array(
17 'label' => '',
18 'exclude' => 0,
19 'id' => 'profile_image_url',
20 'table' => 'twitter_account',
21 'field' => 'profile_image_url',
22 'relationship' => 'none',
23 ),
24 'text' => array(
25 'label' => '',
26 'exclude' => 0,
27 'id' => 'text',
28 'table' => 'twitter',
29 'field' => 'text',
30 'relationship' => 'none',
31 ),
32 'created_time' => array(
33 'label' => '',
34 'date_format' => 'time ago',
35 'custom_date_format' => '',
36 'exclude' => 0,
37 'id' => 'created_time',
38 'table' => 'twitter',
39 'field' => 'created_time',
40 'relationship' => 'none',
41 ),
42 ));
43 $handler->override_option('sorts', array(
44 'created_time' => array(
45 'order' => 'DESC',
46 'id' => 'created_time',
47 'table' => 'twitter',
48 'field' => 'created_time',
49 'relationship' => 'none',
50 ),
51 ));
52 $handler->override_option('arguments', array(
53 'uid' => array(
54 'default_action' => 'default',
55 'style_plugin' => 'default_summary',
56 'style_options' => array(),
57 'wildcard' => 'all',
58 'wildcard_substitution' => 'All author',
59 'title' => '%1\'s tweets',
60 'default_argument_type' => 'user',
61 'default_argument' => '',
62 'validate_type' => 'none',
63 'validate_fail' => 'not found',
64 'break_phrase' => 0,
65 'not' => 0,
66 'id' => 'uid',
67 'table' => 'users',
68 'field' => 'uid',
69 'relationship' => 'none',
70 'default_argument_user' => 1,
71 'default_argument_fixed' => '',
72 'default_argument_php' => '',
73 'validate_argument_node_type' => array(
74 'poll' => 0,
75 'page' => 0,
76 'review' => 0,
77 'story' => 0,
78 ),
79 'validate_argument_node_access' => 0,
80 'validate_argument_nid_type' => 'nid',
81 'validate_argument_vocabulary' => array(),
82 'validate_argument_type' => 'tid',
83 'validate_argument_php' => '',
84 ),
85 ));
86 $handler->override_option('filters', array(
87 'protected' => array(
88 'operator' => '=',
89 'value' => 0,
90 'group' => '0',
91 'exposed' => FALSE,
92 'expose' => array(
93 'operator' => FALSE,
94 'label' => '',
95 ),
96 'id' => 'protected',
97 'table' => 'twitter_account',
98 'field' => 'protected',
99 'relationship' => 'none',
100 ),
101 ));
102 $handler->override_option('access', array(
103 'type' => 'none',
104 'role' => array(),
105 'perm' => '',
106 ));
107 $handler->override_option('use_pager', 'mini');
108 $handler->override_option('style_plugin', 'table');
109 $handler->override_option('style_options', array(
110 'grouping' => '',
111 'override' => 1,
112 'sticky' => 0,
113 'order' => 'asc',
114 'columns' => array(
115 'profile_image_url' => 'profile_image_url',
116 'text' => 'text',
117 'created_time' => 'text',
118 ),
119 'info' => array(
120 'profile_image_url' => array(
121 'sortable' => 0,
122 'separator' => '',
123 ),
124 'text' => array(
125 'sortable' => 0,
126 'separator' => ' &#8212; ',
127 ),
128 'created_time' => array(
129 'sortable' => 0,
130 'separator' => '',
131 ),
132 ),
133 'default' => '-1',
134 ));
135 $handler = $view->new_display('page', 'Page', 'page');
136 $handler->override_option('path', 'user/%/tweets');
137 $handler->override_option('menu', array(
138 'type' => 'tab',
139 'title' => 'Twitter',
140 'weight' => '1',
141 ));
142 $handler->override_option('tab_options', array(
143 'type' => 'none',
144 'title' => '',
145 'weight' => 0,
146 ));
147 $handler = $view->new_display('block', 'Block', 'block');
148 $handler->override_option('fields', array(
149 'text' => array(
150 'label' => '',
151 'exclude' => 0,
152 'id' => 'text',
153 'table' => 'twitter',
154 'field' => 'text',
155 'relationship' => 'none',
156 ),
157 'created_time' => array(
158 'label' => '',
159 'date_format' => 'time ago',
160 'custom_date_format' => '',
161 'exclude' => 0,
162 'id' => 'created_time',
163 'table' => 'twitter',
164 'field' => 'created_time',
165 'relationship' => 'none',
166 ),
167 ));
168 $handler->override_option('items_per_page', 5);
169 $handler->override_option('use_more', 1);
170 $handler->override_option('style_plugin', 'list');
171 $handler->override_option('row_options', array(
172 'inline' => array(
173 'text' => 'text',
174 'created_time' => 'created_time',
175 ),
176 'separator' => ' &#8212; ',
177 ));
178 $handler->override_option('block_description', 'User Tweets');
179
180 return array('tweets' => $view);
181 }

  ViewVC Help
Powered by ViewVC 1.1.2