3 * Test Generated example of using price_field create API
6 function price_field_create_example(){
9 'name' => 'grassvariety',
10 'label' => 'Grass Variety',
11 'html_type' => 'Text',
17 $result = civicrm_api3('price_field', 'create', $params);
19 catch (CiviCRM_API3_Exception
$e) {
21 $errorMessage = $e->getMessage();
22 $errorCode = $e->getErrorCode();
23 $errorData = $e->getExtraParams();
24 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
31 * Function returns array of result expected from previous function
33 function price_field_create_expectedresult(){
35 $expectedResult = array(
43 'price_set_id' => '3',
44 'name' => 'grassvariety',
45 'label' => 'Grass Variety',
46 'html_type' => 'Text',
47 'is_enter_qty' => '1',
51 'is_display_amounts' => '',
52 'options_per_line' => '',
58 'visibility_id' => '',
63 return $expectedResult;
68 * This example has been generated from the API test suite. The test that created it is called
70 * testCreatePriceField and can be found in
71 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldTest.php
73 * You can see the outcome of the API tests at
74 * https://test.civicrm.org/job/CiviCRM-master-git/
76 * To Learn about the API read
77 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
79 * Browse the api on your own site with the api explorer
80 * http://MYSITE.ORG/path/to/civicrm/api/explorer
82 * Read more about testing here
83 * http://wiki.civicrm.org/confluence/display/CRM/Testing
85 * API Standards documentation:
86 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards