3 * Test Generated example demonstrating the UFField.create API.
8 function uf_field_create_example() {
10 'field_name' => 'phone',
11 'field_type' => 'Contact',
12 'visibility' => 'Public Pages and Listings',
14 'label' => 'Test Phone',
17 'location_type_id' => 1,
23 $result = civicrm_api3('UFField', 'create', $params);
25 catch (CiviCRM_API3_Exception
$e) {
27 $errorMessage = $e->getMessage();
28 $errorCode = $e->getErrorCode();
29 $errorData = $e->getExtraParams();
31 'error' => $errorMessage,
32 'error_code' => $errorCode,
33 'error_data' => $errorData,
41 * Function returns array of result expected from previous function.
46 function uf_field_create_expectedresult() {
48 $expectedResult = array(
56 'uf_group_id' => '11',
57 'field_name' => 'phone',
64 'visibility' => 'Public Pages and Listings',
66 'is_searchable' => '1',
67 'location_type_id' => '1',
68 'phone_type_id' => '1',
69 'website_type_id' => '',
70 'label' => 'Test Phone',
71 'field_type' => 'Contact',
73 'is_multi_summary' => '',
78 return $expectedResult;
82 * This example has been generated from the API test suite.
83 * The test that created it is called "testCreateUFField"
84 * and can be found at:
85 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php
87 * You can see the outcome of the API tests at
88 * https://test.civicrm.org/job/CiviCRM-master-git/
90 * To Learn about the API read
91 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
93 * Browse the api on your own site with the api explorer
94 * http://MYSITE.ORG/path/to/civicrm/api
96 * Read more about testing here
97 * http://wiki.civicrm.org/confluence/display/CRM/Testing
99 * API Standards documentation:
100 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards