4 * Test Generated API Example.
5 * See bottom of this file for more detail.
9 * Test Generated example of using uf_field create API.
15 function uf_field_create_example() {
17 'field_name' => 'phone',
18 'field_type' => 'Contact',
19 'visibility' => 'Public Pages and Listings',
21 'label' => 'Test Phone',
24 'location_type_id' => 1,
30 $result = civicrm_api3('uf_field', 'create', $params);
32 catch (CiviCRM_API3_Exception
$e) {
34 $errorMessage = $e->getMessage();
35 $errorCode = $e->getErrorCode();
36 $errorData = $e->getExtraParams();
38 'error' => $errorMessage,
39 'error_code' => $errorCode,
40 'error_data' => $errorData,
48 * Function returns array of result expected from previous function.
53 function uf_field_create_expectedresult() {
55 $expectedResult = array(
63 'uf_group_id' => '11',
64 'field_name' => 'phone',
71 'visibility' => 'Public Pages and Listings',
73 'is_searchable' => '1',
74 'location_type_id' => '1',
75 'phone_type_id' => '1',
76 'website_type_id' => '',
77 'label' => 'Test Phone',
78 'field_type' => 'Contact',
80 'is_multi_summary' => '',
85 return $expectedResult;
89 * This example has been generated from the API test suite.
90 * The test that created it is called
93 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php
95 * You can see the outcome of the API tests at
96 * https://test.civicrm.org/job/CiviCRM-master-git/
98 * To Learn about the API read
99 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
101 * Browse the api on your own site with the api explorer
102 * http://MYSITE.ORG/path/to/civicrm/api/explorer
104 * Read more about testing here
105 * http://wiki.civicrm.org/confluence/display/CRM/Testing
107 * API Standards documentation:
108 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards