Merge pull request #18852 from eileenmcnaughton/aip
[civicrm-core.git] / api / v3 / Website.php
CommitLineData
6a488035 1<?php
6a488035
TO
2/*
3 +--------------------------------------------------------------------+
a30c801b 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 5 | |
a30c801b
TO
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
6a488035 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
6a488035
TO
11
12/**
b081365f 13 * This api exposes CiviCRM website records.
6a488035
TO
14 *
15 * @package CiviCRM_APIv3
6a488035
TO
16 */
17
6a488035 18/**
1747ab99 19 * Add an Website for a contact.
6a488035 20 *
c490a46a 21 * @param array $params
77b97be7 22 *
a6c01b45 23 * @return array
00f8641b 24 * API result array
6a488035
TO
25 */
26function civicrm_api3_website_create($params) {
ebdf0a2c 27 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Website');
11e09c59 28}
6a488035 29
11e09c59 30/**
0aa0303c
EM
31 * Adjust Metadata for Create action.
32 *
33 * The metadata is used for setting defaults, documentation & validation.
6a488035 34 *
cf470720 35 * @param array $params
b081365f 36 * Array of parameters determined by getfields.
6a488035
TO
37 */
38function _civicrm_api3_website_create_spec(&$params) {
39 $params['contact_id']['api.required'] = 1;
40}
41
42/**
9d32e6f7
EM
43 * Deletes an existing Website.
44 *
cf470720 45 * @param array $params
9d32e6f7 46 *
1bc8dc45 47 * @return array
00f8641b 48 * API result array
1bc8dc45 49 * @throws \API_Exception
6a488035
TO
50 */
51function civicrm_api3_website_delete($params) {
deeb0e2b 52 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
6a488035
TO
53}
54
55/**
9d32e6f7 56 * Retrieve one or more websites.
6a488035 57 *
317fceb4 58 * @param array $params
6a488035 59 *
a6c01b45 60 * @return array
00f8641b 61 * API result array
6a488035
TO
62 */
63function civicrm_api3_website_get($params) {
244bbdd8 64 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Website');
6a488035 65}