3 * Test Generated example of using group getfields API
4 * demonstrate use of getfields to interogate api *
6 function group_getfields_example(){
12 $result = civicrm_api3('group', 'getfields', $params);
14 catch (CiviCRM_API3_Exception
$e) {
16 $errorMessage = $e->getMessage();
17 $errorCode = $e->getErrorCode();
18 $errorData = $e->getExtraParams();
19 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
26 * Function returns array of result expected from previous function
28 function group_getfields_expectedresult(){
30 $expectedResult = array(
38 'title' => 'Group ID',
40 'api.aliases' => array(
47 'title' => 'Group Name',
54 'title' => 'Group Title',
59 'description' => array(
60 'name' => 'description',
62 'title' => 'Group Description',
69 'title' => 'Group Source',
73 'saved_search_id' => array(
74 'name' => 'saved_search_id',
76 'title' => 'Saved Search ID',
77 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
80 'name' => 'is_active',
82 'title' => 'Group Enabled',
85 'visibility' => array(
86 'name' => 'visibility',
88 'title' => 'Group Visibility Setting',
89 'default' => 'User and User Admin Only',
90 'enumValues' => 'User and User Admin Only,Public Pages',
92 'where_clause' => array(
93 'name' => 'where_clause',
95 'title' => 'Group Where Clause',
97 'select_tables' => array(
98 'name' => 'select_tables',
100 'title' => 'Tables For Select Clause',
102 'where_tables' => array(
103 'name' => 'where_tables',
105 'title' => 'Tables For Where Clause',
107 'group_type' => array(
108 'name' => 'group_type',
110 'title' => 'Group Type',
114 'cache_date' => array(
115 'name' => 'cache_date',
117 'title' => 'Group Cache Date',
119 'refresh_date' => array(
120 'name' => 'refresh_date',
122 'title' => 'Next Group Refresh Time',
127 'title' => 'Group Parents',
130 'name' => 'children',
132 'title' => 'Group Children',
134 'is_hidden' => array(
135 'name' => 'is_hidden',
137 'title' => 'Group is Hidden',
139 'is_reserved' => array(
140 'name' => 'is_reserved',
142 'title' => 'Group is Reserved',
144 'created_id' => array(
145 'name' => 'created_id',
147 'title' => 'Group Created By',
148 'FKClassName' => 'CRM_Contact_DAO_Contact',
153 return $expectedResult;
158 * This example has been generated from the API test suite. The test that created it is called
160 * testgetfields and can be found in
161 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupTest.php
163 * You can see the outcome of the API tests at
164 * https://test.civicrm.org/job/CiviCRM-master-git/
166 * To Learn about the API read
167 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
169 * Browse the api on your own site with the api explorer
170 * http://MYSITE.ORG/path/to/civicrm/api/explorer
172 * Read more about testing here
173 * http://wiki.civicrm.org/confluence/display/CRM/Testing
175 * API Standards documentation:
176 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards