-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtourney.views.inc
228 lines (211 loc) · 6.38 KB
/
tourney.views.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<?php
/*
* @file
*/
/**
* Implements hook_views_data_alter().
*/
function tourney_views_data_alter(&$data) {
$data['tourney_tournament']['edit_link'] = array(
'field' => array(
'title' => t('Edit Link'),
'help' => t('Provide a simple link to edit the tournament.'),
'handler' => 'tourney_handler_field_entity_link_edit',
)
);
$data['tourney_tournament']['match_view_link'] = array(
'field' => array(
'title' => t('Match View Link'),
'help' => t('Provide a link to the match view.'),
'handler' => 'tourney_handler_field_match_view_link',
)
);
// Tournery Match additions
$data['tourney_match']['edit_link'] = array(
'field' => array(
'title' => t('Edit Link'),
'help' => t('Provide a simple link to edit the match.'),
'handler' => 'tourney_handler_field_entity_link_edit',
)
);
$data['tourney_match']['game_view_link'] = array(
'field' => array(
'title' => t('Game View Link'),
'help' => t('Provide a link to list the games in a given match.'),
'handler' => 'tourney_handler_field_game_view_link',
)
);
$data['tourney_match']['match_tree'] = array(
'title' => t('Match Tree'),
'help' => t('Match ID with depth'),
'field' => array(
'real field' => 'id',
'handler' => 'views_handler_field',
),
'argument' => array(
'real field' => 'id',
'handler' => 'tourney_handler_match_tree',
),
);
$data['tourney_match']['match_tree_depth'] = array(
'title' => t('Match Tree Depth'),
'help' => t('Match ID custom depth filter'),
'field' => array(
'real field' => 'id',
'handler' => 'views_handler_field',
),
'argument' => array(
'real field' => 'id',
'handler' => 'views_handler_argument',
),
);
// Define the field for the gameIds on the match object
$data['tourney_match']['game_ids'] = array(
'title' => t('Game Ids'),
'help' => t('An array of game ids loaded on the match object'),
'field' => array(
'handler' => 'tourney_handler_field_object_property',
),
);
$data['tourney_match']['tournament_id'] = array(
'title' => t('Tournament Id'),
'help' => t('The tournament id loaded on the match object'),
'field' => array(
'handler' => 'tourney_handler_field_object_property',
),
);
$data['tourney_match']['match_slot'] = array(
'title' => t('Match Slot ID'),
'help' => t('The internal match slot provided by tourney plugin for match.'),
'argument' => array(
'handler' => 'tourney_handler_argument_match_id',
),
);
// Tourney Game additions
$data['tourney_game']['edit_game'] = array(
'field' => array(
'title' => t('Edit link'),
'help' => t('Provide a simple link to edit the game.'),
'handler' => 'tourney_handler_field_entity_link_edit',
),
);
$data['tourney_game']['tournament_id'] = array(
'title' => t('Tournament Id'),
'help' => t('The tournament id loaded on the game object'),
'field' => array(
'handler' => 'tourney_handler_field_object_property',
),
);
// generic footer/header links
$data['views']['parent_match'] = array(
'title' => t('Link to Parent Match'),
'help' => t('Provide a link to the parent match.'),
'area' => array(
'handler' => 'views_handler_parent_match_link',
),
);
$data['views']['parent_tourney'] = array(
'title' => t('Link to Parent Tournament'),
'help' => t('Provide a link to the parent tourney.'),
'area' => array(
'handler' => 'views_handler_parent_tourney_link',
),
);
$data['tourney_rank']['table']['group'] = t('Tourney Rank');
// relationship
$data['node']['tourney_rank_rel'] = array(
'group' => t('Tourney Rank'),
'title' => t('Tourney Rank'),
'real field' => 'nid',
'help' => t('Create a tourney rank relationship to a node.'),
'relationship' => array(
'handler' => 'views_handler_relationship',
'base' => 'tourney_rank',
'base field' => 'entity_id',
'label' => t('tourney'),
'title' => t('tourney'),
),
);
$data['user']['tourney_rank_rel'] = array(
'group' => t('Tourney Rank'),
'title' => t('Tourney Rank'),
'real field' => 'uid',
'help' => t('Create a tourney rank relationship to a user.'),
'relationship' => array(
'handler' => 'views_handler_relationship',
'base' => 'tourney_rank',
'base field' => 'entity_id',
'label' => t('tourney'),
'title' => t('tourney'),
),
);
// $data['tourney_rank']['table']['join'] = array(
// 'users' => array(
// 'left_field' => 'uid',
// 'field' => 'entity_id',
// 'extra' => array(
// array('field' => 'entity_type', 'value' => 'user'),
// ),
// ),
// 'node' => array(
// 'left_field' => 'nid',
// 'field' => 'entity_id',
// 'extra' => array(
// array('field' => 'entity_type', 'value' => 'node'),
// ),
// ),
// );
$data['tourney_rank']['tournament'] = array(
'title' => t('Tournament ID'),
'help' => t('Tournament to filter rank rows.'),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
);
$data['tourney_rank']['rank'] = array(
'title' => t('Contestant Rank'),
'help' => t('Rank contestant has achieved in the tournament.'),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'field' => array(
'handler' => 'views_handler_field_numeric',
),
'sort' => array(
'handler' => 'tourney_handler_sort_rank',
),
);
$data['tourney_rank']['wins'] = array(
'title' => t('Contestant Wins'),
'help' => t('Number of contestant Wins.'),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'field' => array(
'handler' => 'views_handler_field_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['tourney_rank']['losses'] = array(
'title' => t('Contestant Losses'),
'help' => t('Number of contestant Losses.'),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'field' => array(
'handler' => 'views_handler_field_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
}
function tourney_views_handlers() {
return array(
);
}