3 * Test Generated example demonstrating the Tag.getfields API.
5 * Demonstrate use of getfields to interrogate api.
10 function tag_getfields_example() {
16 $result = civicrm_api3('Tag', '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 tag_getfields_expectedresult() {
41 $expectedResult = array(
51 'api.aliases' => array(
58 'title' => 'Tag Name',
64 'description' => array(
65 'name' => 'description',
67 'title' => 'Description',
72 'name' => 'parent_id',
74 'title' => 'Parent Tag',
76 'FKClassName' => 'CRM_Core_DAO_Tag',
79 'is_selectable' => array(
80 'name' => 'is_selectable',
82 'title' => 'Display Tag?',
85 'is_reserved' => array(
86 'name' => 'is_reserved',
88 'title' => 'Reserved',
91 'name' => 'is_tagset',
98 'title' => 'Used For',
105 'pseudoconstant' => array(
106 'optionGroupName' => 'tag_used_for',
108 'api.default' => 'civicrm_contact',
110 'created_id' => array(
111 'name' => 'created_id',
113 'title' => 'Tag Created By',
114 'FKClassName' => 'CRM_Contact_DAO_Contact',
115 'FKApiName' => 'Contact',
117 'created_date' => array(
118 'name' => 'created_date',
120 'title' => 'Tag Created Date',
125 return $expectedResult;
129 * This example has been generated from the API test suite.
130 * The test that created it is called "testTagGetfields"
131 * and can be found at:
132 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php
134 * You can see the outcome of the API tests at
135 * https://test.civicrm.org/job/CiviCRM-master-git/
137 * To Learn about the API read
138 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
140 * Browse the api on your own site with the api explorer
141 * http://MYSITE.ORG/path/to/civicrm/api
143 * Read more about testing here
144 * http://wiki.civicrm.org/confluence/display/CRM/Testing
146 * API Standards documentation:
147 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards