-
Notifications
You must be signed in to change notification settings - Fork 8
/
civicrm_developer.module
211 lines (187 loc) · 9.35 KB
/
civicrm_developer.module
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
<?php
/**
* Implementation of CiviCRM _civicrm_pre hook
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_pre
*/
function civicrm_developer_civicrm_pre($op, $objectName, $objectId, &$objectRef) {
drupal_set_message("hook_civicrm_pre called: op is $op, objectName is $objectName, objectID is $objectId");
dpm($objectRef);
}
/**
* Implementation of CiviCRM _civicrm_post hook
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_post
*/
function civicrm_developer_civicrm_post($op, $objectName, $objectId, &$objectRef) {
$msg = "hook_civicrm_post called: op is $op, objectName is $objectName, objectID is $objectId";
drupal_set_message("hook_civicrm_post called: op is $op, objectName is $objectName, objectID is $objectId");
dpm($objectRef, $objectName . "civicrm_post hook");
}
/**
* Implementation of CiviCRM _civicrm_links hook
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_links
*/
function civicrm_developer_civicrm_links($op, $objectName, $objectId, &$links)
{
drupal_set_message("hook_civicrm_links called: op is $op, objectName is $objectName, objectID is $objectId");
dpm($links, "links");
}
/**
* Implementation of CiviCRM _civicrm_validate hook
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_validate
*/
function civicrm_developer_civicrm_validate($formName, &$fields, &$files, &$form){
drupal_set_message("hook_civicrm_links called: formName is $formName");
dpm($fields);
dpm($files);
dpm($form);
}
/**
* Implementation of CiviCRM _civicrm_preProcess hook
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_preProcess
*/
function civicrm_developer_civicrm_preProcess($formName, &$form) {
drupal_set_message("hook_civicrm_preProcess called: formName is $formName");
dpm($form);
}
/**
* Implementation of CiviCRM _civicrm_validate hook. This hook is invoked when building a CiviCRM form. This hook should also be used to set the default values of a form element
*
* @formName string the name of the form
* @form object reference to the form object
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_buildForm
*/
function civicrm_developer_civicrm_buildForm($formName, &$form){
drupal_set_message("hook_civicrm_buildForm called: formName is $formName");
dpm($form);
}
/**
* Implementation of CiviCRM _civicrm_postProcess hook. This hook is invoked when a CiviCRM
* form is submitted. If the module has injected any form elements, this hook should save the values in the database.
*
* @formName string the name of the form
* @form object reference to the form object
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_postProcess
*/
function civicrm_developer_civicrm_postProcess($formName, &$form){
drupal_set_message("hook_civicrm_postProcess called: formName is $formName");
dpm(get_defined_vars());
}
/**
* Implementation of CiviCRM _civicrm_pageRun hook. This hook is called before a CiviCRM page is rendered
*
* @formName string the name of the form
* @form object reference to the form object
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_pageRun
*/
function civicrm_developer_civicrm_pageRun(&$page){
drupal_set_message("hook_civicrm_pageRun called. This hook is called before a CiviCRM page is rendered.
Note that this does not execute on every CiviCRM page in the general sense. CiviCRM's pages are classified as either 'Forms' or 'Pages', and this only runs on pages classified as 'Pages'. If you are not sure if a particular page is a Page, test it by adding some temporary debug code to /CRM/Utils/Hook.php");
dpm($page);
}
/**
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_custom
*/
function civicrm_developer_civicrm_custom($op, $groupID, $entityID, &$params){
drupal_set_message("<em>_civicrm_custom</em> called: This hook is called AFTER the db write on a custom table<p>op is $op. </p><br> entityID is $entityID<br> groupID is $groupID.<br>");
dpm($params);
}
/*#
# hook_civicrm_custom
# hook_civicrm_aclWhereClause
# hook_civicrm_aclGroup
# hook_civicrm_dashboard
# hook_civicrm_xmlMenu
# hook_civicrm_alterPaymentProcessorParams
#
# hook_civicrm_copy
# hook_civicrm_tokens
# hook_civicrm_tokenValues
# hook_civicrm_customFieldOptions
# hook_civicrm_searchTasks
*/
/**
* Implementation of CiviCRM _civicrm_postProcess hook. This hook is invoked when a CiviCRM
* form is submitted. If the module has injected any form elements, this hook should save the values in the database.
*
* @formName string the name of the form
* @form object reference to the form object
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_buildAmount
*/
function civicrm_developer_civicrm_buildAmount($pageType,&$form,&$amount){
drupal_set_message("hook_civicrm_buildAmount called: pageType is $pageType");
//get_defined_vars doesn't work here because it just reports 'recursive' - left in to remin
//me why I'm not using it so I don't try to switch :-)
// dpm(get_defined_vars());
dpm($amount,'amount');
dpm($form,'form');
}
/**
* Implementation of CiviCRM _civicrm_tabs hook. This hook is called when composing the tabs to display when viewing a contact
*
* @param array $tabs array of tabs to display
* @param string $contactID id of contact being displayed
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_tabs
*/
function civicrm_developer_civicrm_tabs(&$tabs, $contactID){
drupal_set_message("hook_civicrm_tabs called");
dpm($tabs,'tabs');
dpm($contactID,'contactID');
}
/**
* Implementation of CiviCRM _civicrm_summary hook. This hook is called when contact summary is rendered and you can add on top, below or replace summary with your own html content.
*
* @param array $tabs array of tabs to display
* @param string $contactID id of contact being displayed
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_summary
*/
function civicrm_developer_civicrm_summary($contactID, &$content, &$contentPlacement){
drupal_set_message("hook_civicrm_summary called");
dpm($content,'content');
dpm($contentPlacement ,'contentPlacement');
dpm($contactID,'contactID');
}
/**
* Implementation of CiviCRM _civicrm_searchtasks hook. This hook is called to display the list of actions allowed after doing a contact search. This allows the module developer to inject additional actions or to remove existing actions.
*
* @objectType - the object for this search (currently only Contact, in later versions we will add membership / contribution / participants etc)
* @tasks the current set of tasks for that custom field. You can add/remove existing tasks. Each task needs to have a title and a class.
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_searchTasks
*/
function civicrm_developer_civicrm_searchtasks($objectType, &$tasks){
drupal_set_message("hook_civicrm_searchTasks called: objectType is $objectType. This hook is called to display the list of actions allowed after doing a contact search. This allows the module developer to inject additional actions or to remove existing actions.");
dpm($objectType,'objectType');
dpm($tasks,'tasks');
}
/**
* Implementation of CiviCRM _civicrm_searchcolumns hook. This hook is called after a search is done. This allows the developer to modify the headers and/or the values that are displayed as part of this search. The BIGGEST drawback with this hook is that you may need to modify the result template to include your fields. The result files are CRM/{Contact,Contribute,Member,Event…}/Form/Selector.tpl. However, if you use the same number of columns, you can overwrite the existing columns with the values that you want displayed. This is a HACK, but avoids template modification.
*
* @objectName - the object for this search - activity, campaign, case, contact, contribution, event, grant, membership, and pledge are supported.
* @headers - array (reference) - the list of column headers, an associative array with keys: ( name, sort, order )
* @rows - array (reference) - the list of values, an associate array with fields that are displayed for that component
* @selector - array (reference) - the selector object. Allows you access to the context of the search
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_searchColumns
*/
function civicrm_developer_civicrm_searchcolumns( $objectName, &$headers, &$rows, &$selector ){
drupal_set_message("hook_civicrm_searchColumns called: objectName is $objectName. This hook is called after a search is done. This allows the developer to modify the headers and/or the values that are displayed as part of this search. The BIGGEST drawback with this hook is that you may need to modify the result template to include your fields. The result files are CRM/{Contact,Contribute,Member,Event…}/Form/Selector.tpl. However, if you use the same number of columns, you can overwrite the existing columns with the values that you want displayed. This is a HACK, but avoids template modification.");
dpm($objectName,'objectType');
dpm($headers,'headers');
dpm($rows, 'rows');
dpm($selector,'selector');
}
/*
# hook_civicrm_mailingGroups
# hook_civicrm_contactListQuery
# hook_civicrm_membershipTypeValues
# hook_civicrm_alterMailParams
# hook_civicrm_caseSummary
# hook_civicrm_config
# hook_civicrm_navigationMenu
# hook_civicrm_merge
# hook_civicrm_export
# hook_civicrm_emailProcessor
*/