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();
56 'error' => $errorMessage,
57 'error_code' => $errorCode,
58 'error_data' => $errorData,
66 * Function returns array of result expected from previous function.
71 function uf_field_replace_expectedresult() {
73 $expectedResult = array(
80 'uf_group_id' => '11',
81 'field_name' => 'first_name',
88 'visibility' => 'Public Pages and Listings',
90 'is_searchable' => '1',
91 'location_type_id' => '',
92 'phone_type_id' => '',
93 'website_type_id' => '',
94 'label' => 'Test First Name',
95 'field_type' => 'Contact',
97 'is_multi_summary' => '',
101 'uf_group_id' => '11',
102 'field_name' => 'country',
109 'visibility' => 'Public Pages and Listings',
111 'is_searchable' => '1',
112 'location_type_id' => '1',
113 'phone_type_id' => '',
114 'website_type_id' => '',
115 'label' => 'Test Country',
116 'field_type' => 'Contact',
118 'is_multi_summary' => '',
122 'uf_group_id' => '11',
123 'field_name' => 'phone',
130 'visibility' => 'Public Pages and Listings',
132 'is_searchable' => '1',
133 'location_type_id' => '1',
134 'phone_type_id' => '1',
135 'website_type_id' => '',
136 'label' => 'Test Phone',
137 'field_type' => 'Contact',
139 'is_multi_summary' => '',
144 return $expectedResult;
148 * This example has been generated from the API test suite.
149 * The test that created it is called "testReplaceUFFields"
150 * and can be found at:
151 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php
153 * You can see the outcome of the API tests at
154 * https://test.civicrm.org/job/CiviCRM-master-git/
156 * To Learn about the API read
157 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
159 * Browse the api on your own site with the api explorer
160 * http://MYSITE.ORG/path/to/civicrm/api
162 * Read more about testing here
163 * http://wiki.civicrm.org/confluence/display/CRM/Testing
165 * API Standards documentation:
166 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards