Merge pull request #17656 from civicrm/5.27
[civicrm-core.git] / api / v3 / WordReplacement.php
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 WordReplacement records.
14 *
15 * Word replacements are used to globally alter strings in the CiviCRM UI.
16 * Note that the original source string is always English, regardless of language settings.
17 *
18 * @package CiviCRM_APIv3
19 */
20
21 /**
22 * Get CiviCRM Word Replacement details.
23 *
24 * @param array $params
25 *
26 * @return array
27 * @throws \API_Exception
28 */
29 function civicrm_api3_word_replacement_get($params) {
30 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
31 }
32
33 /**
34 * Create a new Word Replacement.
35 *
36 * @param array $params
37 *
38 * @return array
39 */
40 function civicrm_api3_word_replacement_create($params) {
41 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'WordReplacement');
42 }
43
44 /**
45 * Adjust Metadata for Create action.
46 *
47 * The metadata is used for setting defaults, documentation & validation.
48 *
49 * @param array $params
50 * Array of parameters determined by getfields.
51 */
52 function _civicrm_api3_word_replacement_create_spec(&$params) {
53 $params['find_word']['api.required'] = 1;
54 $params['replace_word']['api.required'] = 1;
55 $params['is_active']['api.default'] = 1;
56 }
57
58 /**
59 * Delete an existing WordReplacement.
60 *
61 * @param array $params
62 * Array containing id of the WordReplacement to be deleted.
63 *
64 * @return array
65 * API result array
66 */
67 function civicrm_api3_word_replacement_delete($params) {
68 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
69 }