3 * Test Generated example demonstrating the UFField.replace API.
8 function uf_field_replace_example() {
11 'option.autoweight' => '',
14 'field_name' => 'first_name',
15 'field_type' => 'Contact',
16 'visibility' => 'Public Pages and Listings',
18 'label' => 'Test First Name',
23 'field_name' => 'country',
24 'field_type' => 'Contact',
25 'visibility' => 'Public Pages and Listings',
27 'label' => 'Test Country',
30 'location_type_id' => 1,
33 'field_name' => 'phone',
34 'field_type' => 'Contact',
35 'visibility' => 'Public Pages and Listings',
37 'label' => 'Test Phone',
40 'location_type_id' => 1,
44 'check_permissions' => TRUE,
48 $result = civicrm_api3('UFField', 'replace', $params);
50 catch (CiviCRM_API3_Exception
$e) {
52 $errorMessage = $e->getMessage();
53 $errorCode = $e->getErrorCode();
54 $errorData = $e->getExtraParams();
57 'error_message' => $errorMessage,
58 'error_code' => $errorCode,
59 'error_data' => $errorData,
67 * Function returns array of result expected from previous function.
72 function uf_field_replace_expectedresult() {
81 'uf_group_id' => '11',
82 'field_name' => 'first_name',
89 'visibility' => 'Public Pages and Listings',
91 'is_searchable' => '1',
92 'location_type_id' => '',
93 'phone_type_id' => '',
94 'website_type_id' => '',
95 'label' => 'Test First Name',
96 'field_type' => 'Contact',
98 'is_multi_summary' => '',
102 'uf_group_id' => '11',
103 'field_name' => 'country',
110 'visibility' => 'Public Pages and Listings',
112 'is_searchable' => '1',
113 'location_type_id' => '1',
114 'phone_type_id' => '',
115 'website_type_id' => '',
116 'label' => 'Test Country',
117 'field_type' => 'Contact',
119 'is_multi_summary' => '',
123 'uf_group_id' => '11',
124 'field_name' => 'phone',
131 'visibility' => 'Public Pages and Listings',
133 'is_searchable' => '1',
134 'location_type_id' => '1',
135 'phone_type_id' => '1',
136 'website_type_id' => '',
137 'label' => 'Test Phone',
138 'field_type' => 'Contact',
140 'is_multi_summary' => '',
145 return $expectedResult;
149 * This example has been generated from the API test suite.
150 * The test that created it is called "testReplaceUFFields"
151 * and can be found at:
152 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php
154 * You can see the outcome of the API tests at
155 * https://test.civicrm.org/job/CiviCRM-master-git/
157 * To Learn about the API read
158 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
160 * Browse the api on your own site with the api explorer
161 * http://MYSITE.ORG/path/to/civicrm/api
163 * Read more about testing here
164 * http://wiki.civicrm.org/confluence/display/CRM/Testing
166 * API Standards documentation:
167 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards