3 * Test Generated example of using uf_field create API
6 function uf_field_create_example(){
8 'field_name' => 'phone',
9 'field_type' => 'Contact',
10 'visibility' => 'Public Pages and Listings',
12 'label' => 'Test Phone',
15 'location_type_id' => 1,
21 $result = civicrm_api3('uf_field', 'create', $params);
23 catch (CiviCRM_API3_Exception
$e) {
25 $errorMessage = $e->getMessage();
26 $errorCode = $e->getErrorCode();
27 $errorData = $e->getExtraParams();
28 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
35 * Function returns array of result expected from previous function
37 function uf_field_create_expectedresult(){
39 $expectedResult = array(
47 'uf_group_id' => '11',
48 'field_name' => 'phone',
55 'visibility' => 'Public Pages and Listings',
57 'is_searchable' => '1',
58 'location_type_id' => '1',
59 'phone_type_id' => '1',
60 'label' => 'Test Phone',
61 'field_type' => 'Contact',
63 'is_multi_summary' => '',
68 return $expectedResult;
73 * This example has been generated from the API test suite. The test that created it is called
75 * testCreateUFField and can be found in
76 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php
78 * You can see the outcome of the API tests at
79 * https://test.civicrm.org/job/CiviCRM-master-git/
81 * To Learn about the API read
82 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
84 * Browse the api on your own site with the api explorer
85 * http://MYSITE.ORG/path/to/civicrm/api/explorer
87 * Read more about testing here
88 * http://wiki.civicrm.org/confluence/display/CRM/Testing
90 * API Standards documentation:
91 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards