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,
47 $result = civicrm_api3('UFField', 'replace', $params);
49 catch (CiviCRM_API3_Exception
$e) {
51 $errorMessage = $e->getMessage();
52 $errorCode = $e->getErrorCode();
53 $errorData = $e->getExtraParams();
55 'error' => $errorMessage,
56 'error_code' => $errorCode,
57 'error_data' => $errorData,
65 * Function returns array of result expected from previous function.
70 function uf_field_replace_expectedresult() {
72 $expectedResult = array(
79 'uf_group_id' => '11',
80 'field_name' => 'first_name',
87 'visibility' => 'Public Pages and Listings',
89 'is_searchable' => '1',
90 'location_type_id' => '',
91 'phone_type_id' => '',
92 'website_type_id' => '',
93 'label' => 'Test First Name',
94 'field_type' => 'Contact',
96 'is_multi_summary' => '',
100 'uf_group_id' => '11',
101 'field_name' => 'country',
108 'visibility' => 'Public Pages and Listings',
110 'is_searchable' => '1',
111 'location_type_id' => '1',
112 'phone_type_id' => '',
113 'website_type_id' => '',
114 'label' => 'Test Country',
115 'field_type' => 'Contact',
117 'is_multi_summary' => '',
121 'uf_group_id' => '11',
122 'field_name' => 'phone',
129 'visibility' => 'Public Pages and Listings',
131 'is_searchable' => '1',
132 'location_type_id' => '1',
133 'phone_type_id' => '1',
134 'website_type_id' => '',
135 'label' => 'Test Phone',
136 'field_type' => 'Contact',
138 'is_multi_summary' => '',
143 return $expectedResult;
147 * This example has been generated from the API test suite.
148 * The test that created it is called "testReplaceUFFields"
149 * and can be found at:
150 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php
152 * You can see the outcome of the API tests at
153 * https://test.civicrm.org/job/CiviCRM-master-git/
155 * To Learn about the API read
156 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
158 * Browse the api on your own site with the api explorer
159 * http://MYSITE.ORG/path/to/civicrm/api
161 * Read more about testing here
162 * http://wiki.civicrm.org/confluence/display/CRM/Testing
164 * API Standards documentation:
165 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards