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 'website_type_id' => '',
84 'label' => 'Test First Name',
85 'field_type' => 'Contact',
87 'is_multi_summary' => '',
91 'uf_group_id' => '11',
92 'field_name' => 'country',
99 'visibility' => 'Public Pages and Listings',
101 'is_searchable' => '1',
102 'location_type_id' => '1',
103 'phone_type_id' => '',
104 'website_type_id' => '',
105 'label' => 'Test Country',
106 'field_type' => 'Contact',
108 'is_multi_summary' => '',
112 'uf_group_id' => '11',
113 'field_name' => 'phone',
120 'visibility' => 'Public Pages and Listings',
122 'is_searchable' => '1',
123 'location_type_id' => '1',
124 'phone_type_id' => '1',
125 'website_type_id' => '',
126 'label' => 'Test Phone',
127 'field_type' => 'Contact',
129 'is_multi_summary' => '',
134 return $expectedResult;
139 * This example has been generated from the API test suite. The test that created it is called
141 * testReplaceUFFields and can be found in
142 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php
144 * You can see the outcome of the API tests at
145 * https://test.civicrm.org/job/CiviCRM-master-git/
147 * To Learn about the API read
148 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
150 * Browse the api on your own site with the api explorer
151 * http://MYSITE.ORG/path/to/civicrm/api/explorer
153 * Read more about testing here
154 * http://wiki.civicrm.org/confluence/display/CRM/Testing
156 * API Standards documentation:
157 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards