<?php
-
-/*
-
+/**
+ * Test Generated example of using uf_field create API
+ * *
*/
function uf_field_create_example(){
$params = array(
'is_active' => 1,
'location_type_id' => 1,
'phone_type_id' => 1,
- 'version' => 3,
'uf_group_id' => 11,
);
- $result = civicrm_api( 'uf_field','create',$params );
+try{
+ $result = civicrm_api3('uf_field', 'create', $params);
+}
+catch (CiviCRM_API3_Exception $e) {
+ // handle error here
+ $errorMessage = $e->getMessage();
+ $errorCode = $e->getErrorCode();
+ $errorData = $e->getExtraParams();
+ return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
+}
- return $result;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function uf_field_create_expectedresult(){
),
);
- return $expectedResult ;
+ return $expectedResult;
}