3 * Test Generated example demonstrating the Group.getfields API.
5 * Demonstrate use of getfields to interrogate api.
10 function group_getfields_example() {
16 $result = civicrm_api3('Group', 'getfields', $params);
18 catch (CiviCRM_API3_Exception
$e) {
20 $errorMessage = $e->getMessage();
21 $errorCode = $e->getErrorCode();
22 $errorData = $e->getExtraParams();
24 'error' => $errorMessage,
25 'error_code' => $errorCode,
26 'error_data' => $errorData,
34 * Function returns array of result expected from previous function.
39 function group_getfields_expectedresult() {
41 $expectedResult = array(
49 'title' => 'Group ID',
51 'api.aliases' => array(
58 'title' => 'Group Name',
65 'title' => 'Group Title',
70 'description' => array(
71 'name' => 'description',
73 'title' => 'Group Description',
83 'title' => 'Group Source',
87 'saved_search_id' => array(
88 'name' => 'saved_search_id',
90 'title' => 'Saved Search ID',
91 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
92 'FKApiName' => 'SavedSearch',
95 'name' => 'is_active',
97 'title' => 'Group Enabled',
100 'visibility' => array(
101 'name' => 'visibility',
103 'title' => 'Group Visibility Setting',
106 'default' => 'User and User Admin Only',
110 'pseudoconstant' => array(
111 'callback' => 'CRM_Core_SelectValues::groupVisibility',
114 'where_clause' => array(
115 'name' => 'where_clause',
117 'title' => 'Group Where Clause',
119 'select_tables' => array(
120 'name' => 'select_tables',
122 'title' => 'Tables For Select Clause',
124 'where_tables' => array(
125 'name' => 'where_tables',
127 'title' => 'Tables For Where Clause',
129 'group_type' => array(
130 'name' => 'group_type',
132 'title' => 'Group Type',
136 'cache_date' => array(
137 'name' => 'cache_date',
139 'title' => 'Group Cache Date',
141 'refresh_date' => array(
142 'name' => 'refresh_date',
144 'title' => 'Next Group Refresh Time',
149 'title' => 'Group Parents',
152 'name' => 'children',
154 'title' => 'Group Children',
156 'is_hidden' => array(
157 'name' => 'is_hidden',
159 'title' => 'Group is Hidden',
161 'is_reserved' => array(
162 'name' => 'is_reserved',
164 'title' => 'Group is Reserved',
166 'created_id' => array(
167 'name' => 'created_id',
169 'title' => 'Group Created By',
170 'FKClassName' => 'CRM_Contact_DAO_Contact',
171 'FKApiName' => 'Contact',
173 'modified_id' => array(
174 'name' => 'modified_id',
176 'title' => 'Group Modified By',
177 'FKClassName' => 'CRM_Contact_DAO_Contact',
178 'FKApiName' => 'Contact',
183 return $expectedResult;
187 * This example has been generated from the API test suite.
188 * The test that created it is called "testgetfields"
189 * and can be found at:
190 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupTest.php
192 * You can see the outcome of the API tests at
193 * https://test.civicrm.org/job/CiviCRM-master-git/
195 * To Learn about the API read
196 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
198 * Browse the api on your own site with the api explorer
199 * http://MYSITE.ORG/path/to/civicrm/api
201 * Read more about testing here
202 * http://wiki.civicrm.org/confluence/display/CRM/Testing
204 * API Standards documentation:
205 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards