Fix Typo on Search Settings page.
[civicrm-core.git] / api / v3 / LocationType.php
... / ...
CommitLineData
1<?php
2/*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 |
9 +--------------------------------------------------------------------+
10 */
11
12/**
13 * This api exposes CiviCRM LocationType records.
14 *
15 * @package CiviCRM_APIv3
16 */
17
18/**
19 * Add a LocationType.
20 *
21 * @param array $params
22 *
23 * @return array
24 * API result array.
25 */
26function civicrm_api3_location_type_create($params) {
27 //set display_name equal to name if it's not defined
28 if (!array_key_exists('display_name', $params) && array_key_exists('name', $params)) {
29 $params['display_name'] = $params['name'];
30 }
31
32 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'LocationType');
33}
34
35/**
36 * Adjust Metadata for Create action.
37 *
38 * The metadata is used for setting defaults, documentation & validation.
39 *
40 * @param array $params
41 * Array of parameters determined by getfields.
42 */
43function _civicrm_api3_location_type_create_spec(&$params) {
44 $params['is_active']['api.default'] = 1;
45 $params['name']['api.required'] = 1;
46}
47
48/**
49 * Deletes an existing LocationType.
50 *
51 * @param array $params
52 *
53 * @return array
54 * API result array.
55 */
56function civicrm_api3_location_type_delete($params) {
57 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
58}
59
60/**
61 * Retrieve one or more LocationTypes.
62 *
63 * @param array $params
64 * An associative array of name/value pairs.
65 *
66 * @return array
67 * API result array.
68 */
69function civicrm_api3_location_type_get($params) {
70 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
71}