f8e91c0bfada76cfe6c79a8718622de886b71f19
3 * Test Generated example of using custom_field create API.
8 function custom_field_create_example() {
10 'custom_group_id' => 1,
11 'name' => 'test_textfield2',
13 'html_type' => 'Text',
14 'data_type' => 'String',
15 'default_value' => 'abc',
23 $result = civicrm_api3('custom_field', '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 custom_field_create_expectedresult() {
48 $expectedResult = array(
56 'custom_group_id' => '1',
57 'name' => 'test_textfield2',
59 'data_type' => 'String',
60 'html_type' => 'Text',
61 'default_value' => 'abc',
64 'is_search_range' => 0,
73 'options_per_line' => '',
75 'start_date_years' => '',
76 'end_date_years' => '',
81 'column_name' => 'name1_1',
82 'option_group_id' => '',
89 return $expectedResult;
93 * This example has been generated from the API test suite.
94 * The test that created it is called
95 * testCustomFieldCreateWithEdit
97 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomFieldTest.php
99 * You can see the outcome of the API tests at
100 * https://test.civicrm.org/job/CiviCRM-master-git/
102 * To Learn about the API read
103 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
105 * Browse the api on your own site with the api explorer
106 * http://MYSITE.ORG/path/to/civicrm/api
108 * Read more about testing here
109 * http://wiki.civicrm.org/confluence/display/CRM/Testing
111 * API Standards documentation:
112 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards