3 * Test Generated example demonstrating the PriceField.create API.
8 function price_field_create_example() {
11 'name' => 'grassvariety',
12 'label' => 'Grass Variety',
13 'html_type' => 'Text',
19 $result = civicrm_api3('PriceField', 'create', $params);
21 catch (CiviCRM_API3_Exception
$e) {
23 $errorMessage = $e->getMessage();
24 $errorCode = $e->getErrorCode();
25 $errorData = $e->getExtraParams();
27 'error' => $errorMessage,
28 'error_code' => $errorCode,
29 'error_data' => $errorData,
37 * Function returns array of result expected from previous function.
42 function price_field_create_expectedresult() {
44 $expectedResult = array(
52 'price_set_id' => '3',
53 'name' => 'grassvariety',
54 'label' => 'Grass Variety',
55 'html_type' => 'Text',
56 'is_enter_qty' => '1',
60 'is_display_amounts' => '',
61 'options_per_line' => '',
67 'visibility_id' => '',
72 return $expectedResult;
76 * This example has been generated from the API test suite.
77 * The test that created it is called "testCreatePriceField"
78 * and can be found at:
79 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldTest.php
81 * You can see the outcome of the API tests at
82 * https://test.civicrm.org/job/CiviCRM-master-git/
84 * To Learn about the API read
85 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
87 * Browse the api on your own site with the api explorer
88 * http://MYSITE.ORG/path/to/civicrm/api
90 * Read more about testing here
91 * http://wiki.civicrm.org/confluence/display/CRM/Testing
93 * API Standards documentation:
94 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards