3 * Test Generated example of using uf_field replace API
6 function uf_field_replace_example(){
9 'option.autoweight' => '',
12 'field_name' => 'first_name',
13 'field_type' => 'Contact',
14 'visibility' => 'Public Pages and Listings',
16 'label' => 'Test First Name',
21 'field_name' => 'country',
22 'field_type' => 'Contact',
23 'visibility' => 'Public Pages and Listings',
25 'label' => 'Test Country',
28 'location_type_id' => 1,
31 'field_name' => 'phone',
32 'field_type' => 'Contact',
33 'visibility' => 'Public Pages and Listings',
35 'label' => 'Test Phone',
38 'location_type_id' => 1,
45 $result = civicrm_api3('uf_field', 'replace', $params);
47 catch (CiviCRM_API3_Exception
$e) {
49 $errorMessage = $e->getMessage();
50 $errorCode = $e->getErrorCode();
51 $errorData = $e->getExtraParams();
52 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
59 * Function returns array of result expected from previous function
61 function uf_field_replace_expectedresult(){
63 $expectedResult = array(
70 'uf_group_id' => '11',
71 'field_name' => 'first_name',
78 'visibility' => 'Public Pages and Listings',
80 'is_searchable' => '1',
81 'location_type_id' => '',
82 'phone_type_id' => '',
83 'label' => 'Test First Name',
84 'field_type' => 'Contact',
86 'is_multi_summary' => '',
90 'uf_group_id' => '11',
91 'field_name' => 'country',
98 'visibility' => 'Public Pages and Listings',
100 'is_searchable' => '1',
101 'location_type_id' => '1',
102 'phone_type_id' => '',
103 'label' => 'Test Country',
104 'field_type' => 'Contact',
106 'is_multi_summary' => '',
110 'uf_group_id' => '11',
111 'field_name' => 'phone',
118 'visibility' => 'Public Pages and Listings',
120 'is_searchable' => '1',
121 'location_type_id' => '1',
122 'phone_type_id' => '1',
123 'label' => 'Test Phone',
124 'field_type' => 'Contact',
126 'is_multi_summary' => '',
131 return $expectedResult;
136 * This example has been generated from the API test suite. The test that created it is called
138 * testReplaceUFFields and can be found in
139 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php
141 * You can see the outcome of the API tests at
142 * https://test.civicrm.org/job/CiviCRM-master-git/
144 * To Learn about the API read
145 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
147 * Browse the api on your own site with the api explorer
148 * http://MYSITE.ORG/path/to/civicrm/api/explorer
150 * Read more about testing here
151 * http://wiki.civicrm.org/confluence/display/CRM/Testing
153 * API Standards documentation:
154 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards