3 * Test Generated example of using tag getfields API
4 * demonstrate use of getfields to interrogate api *
6 function tag_getfields_example(){
12 $result = civicrm_api3('tag', '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 tag_getfields_expectedresult(){
30 $expectedResult = array(
40 'api.aliases' => array(
47 'title' => 'Tag Name',
53 'description' => array(
54 'name' => 'description',
56 'title' => 'Description',
61 'name' => 'parent_id',
63 'title' => 'Parent Tag',
65 'FKClassName' => 'CRM_Core_DAO_Tag',
67 'is_selectable' => array(
68 'name' => 'is_selectable',
70 'title' => 'Display Tag?',
73 'is_reserved' => array(
74 'name' => 'is_reserved',
76 'title' => 'Reserved',
79 'name' => 'is_tagset',
86 'title' => 'Used For',
93 'pseudoconstant' => array(
94 'optionGroupName' => 'tag_used_for',
96 'api.default' => 'civicrm_contact',
98 'created_id' => array(
99 'name' => 'created_id',
101 'title' => 'Tag Created By',
102 'FKClassName' => 'CRM_Contact_DAO_Contact',
104 'created_date' => array(
105 'name' => 'created_date',
107 'title' => 'Tag Created Date',
112 return $expectedResult;
117 * This example has been generated from the API test suite. The test that created it is called
119 * testTagGetfields and can be found in
120 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php
122 * You can see the outcome of the API tests at
123 * https://test.civicrm.org/job/CiviCRM-master-git/
125 * To Learn about the API read
126 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
128 * Browse the api on your own site with the api explorer
129 * http://MYSITE.ORG/path/to/civicrm/api/explorer
131 * Read more about testing here
132 * http://wiki.civicrm.org/confluence/display/CRM/Testing
134 * API Standards documentation:
135 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards