7dfa389705d5ad7a159e0fe078d82777f60ff7a8
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();
32 'error_message' => $errorMessage,
33 'error_code' => $errorCode,
34 'error_data' => $errorData,
42 * Function returns array of result expected from previous function.
47 function uf_field_create_expectedresult() {
57 'uf_group_id' => '11',
58 'field_name' => 'phone',
65 'visibility' => 'Public Pages and Listings',
67 'is_searchable' => '1',
68 'location_type_id' => '1',
69 'phone_type_id' => '1',
70 'website_type_id' => '',
71 'label' => 'Test Phone',
72 'field_type' => 'Contact',
74 'is_multi_summary' => '',
79 return $expectedResult;
83 * This example has been generated from the API test suite.
84 * The test that created it is called "testCreateUFField"
85 * and can be found at:
86 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php
88 * You can see the outcome of the API tests at
89 * https://test.civicrm.org/job/CiviCRM-master-git/
91 * To Learn about the API read
92 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
94 * Browse the api on your own site with the api explorer
95 * http://MYSITE.ORG/path/to/civicrm/api
97 * Read more about testing here
98 * http://wiki.civicrm.org/confluence/display/CRM/Testing
100 * API Standards documentation:
101 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards