/
callblast.views.inc
121 lines (110 loc) · 3.43 KB
/
callblast.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
<?php
/**
* Implementation of hook_views_data().
*
* Expose callblast_call table to views, so voipcall
* nodes can be filtered in Views based on the callblast that
* created them.
*/
function callblast_views_data() {
$data = array();
// callblast_call table
$data['callblast_call']['table']['group'] = t('Node');
// link callblast_call table to node table, join on callblast_nid
$data['callblast_call']['table']['join']['node'] = array(
'left_field' => 'nid',
'field' => 'callblast_nid',
);
// link callblast_call table to node table, join on voipcall_nid
$data['callblast_call']['table']['join']['node'] = array(
'left_field' => 'nid',
'field' => 'voipcall_nid',
);
// callblast_call.callblast_nid field
$data['callblast_call']['callblast_nid'] = array(
'group' => t('Call Blast'),
'title' => t('Call Blast Nid'),
'help' => t('The node ID of the Call Blast node.'),
'argument' => array(
// todo? 'handler' => '',
'name field' => 'title', // the field to display in the summary.
'numeric' => TRUE,
'validate type' => 'nid',
),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
// Call Blast Name field
$data['callblast_call']['callblast_title'] = array(
'group' => t('Call Blast'),
'help' => t('The human readable title/name of the Call Blast node '
.'related to the voipcall node being displayed.'),
'field' => array(
'title' => 'Call Blast Title',
'field' => 'callblast_nid', // the real field
'handler' => 'callblast_handler_field_callblast_call_callblast_title',
'click sortable' => TRUE,
),
);
// voipcall button pressed / option selected
// by callee on the dial pad of the phone.
$data['callblast_call']['button_pressed'] = array(
'group' => t('Call Blast'),
'help' => t('Display the button pressed by the call recipient. '),
'field' => array(
'title' => t('Button Pressed'),
'field' => 'voipcall_nid', // real field
'handler' => 'callblast_handler_field_callblast_call_button_pressed',
'click sortable' => TRUE,
),
);
// callblast_call.voipcall_nid field
$data['callblast_call']['voipcall_nid'] = array(
'group' => t('Call Blast'),
'title' => t('Voip Call Nid'),
'help' => t('The node ID of the Voip Call node.'),
'argument' => array(
// todo? 'handler' => '',
'name field' => 'title', // the field to display in the summary.
'numeric' => TRUE,
'validate type' => 'nid',
),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
return $data;
}
/**
* Implementation of hook_views_handlers().
*/
function callblast_views_handlers() {
return array(
'info' => array(
'path' => drupal_get_path('module', 'callblast'),
),
'handlers' => array(
'callblast_handler_field_callblast_call_callblast_title' => array(
'parent' => 'views_handler_field',
),
'callblast_handler_field_callblast_call_button_pressed' => array(
'parent' => 'views_handler_field',
),
),
);
}