3 * Test Generated example demonstrating the Website.get API.
5 * Demonostrates returning field metadata
10 function website_get_example() {
20 $result = civicrm_api3('Website', 'get', $params);
22 catch (CiviCRM_API3_Exception
$e) {
24 $errorMessage = $e->getMessage();
25 $errorCode = $e->getErrorCode();
26 $errorData = $e->getExtraParams();
29 'error_message' => $errorMessage,
30 'error_code' => $errorCode,
31 'error_data' => $errorData,
39 * Function returns array of result expected from previous function.
44 function website_get_expectedresult() {
46 $expectedResult = array(
56 'title' => 'Website ID',
57 'description' => 'Unique Website ID',
59 'table_name' => 'civicrm_website',
60 'entity' => 'Website',
61 'bao' => 'CRM_Core_BAO_Website',
62 'api.aliases' => array(
66 'contact_id' => array(
67 'name' => 'contact_id',
70 'description' => 'FK to Contact ID',
71 'table_name' => 'civicrm_website',
72 'entity' => 'Website',
73 'bao' => 'CRM_Core_BAO_Website',
74 'FKClassName' => 'CRM_Contact_DAO_Contact',
75 'FKApiName' => 'Contact',
81 'description' => 'Website',
85 'where' => 'civicrm_website.url',
86 'headerPattern' => '/Website/i',
87 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/',
89 'table_name' => 'civicrm_website',
90 'entity' => 'Website',
91 'bao' => 'CRM_Core_BAO_Website',
98 'website_type_id' => array(
99 'name' => 'website_type_id',
101 'title' => 'Website Type',
102 'description' => 'Which Website type does this website belong to.',
103 'table_name' => 'civicrm_website',
104 'entity' => 'Website',
105 'bao' => 'CRM_Core_BAO_Website',
111 'pseudoconstant' => array(
112 'optionGroupName' => 'website_type',
113 'optionEditPath' => 'civicrm/admin/options/website_type',
120 return $expectedResult;
124 * This example has been generated from the API test suite.
125 * The test that created it is called "testGetMetadata"
126 * and can be found at:
127 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php
129 * You can see the outcome of the API tests at
130 * https://test.civicrm.org/job/CiviCRM-master-git/
132 * To Learn about the API read
133 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
135 * Browse the api on your own site with the api explorer
136 * http://MYSITE.ORG/path/to/civicrm/api
138 * Read more about testing here
139 * http://wiki.civicrm.org/confluence/display/CRM/Testing
141 * API Standards documentation:
142 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards