Commit | Line | Data |
---|---|---|
d83a3991 | 1 | <?php |
d83a3991 | 2 | /* |
3 | +--------------------------------------------------------------------+ | |
a30c801b | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
d83a3991 | 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 | | |
d83a3991 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
d83a3991 | 11 | |
12 | /** | |
244bbdd8 | 13 | * This api exposes CiviCRM WordReplacement records. |
d83a3991 | 14 | * |
244bbdd8 | 15 | * Word replacements are used to globally alter strings in the CiviCRM UI. |
b081365f | 16 | * Note that the original source string is always English, regardless of language settings. |
d83a3991 | 17 | * |
b081365f | 18 | * @package CiviCRM_APIv3 |
d83a3991 | 19 | */ |
20 | ||
21 | /** | |
9d32e6f7 EM |
22 | * Get CiviCRM Word Replacement details. |
23 | * | |
d0997921 | 24 | * @param array $params |
9d32e6f7 | 25 | * |
645ee340 EM |
26 | * @return array |
27 | * @throws \API_Exception | |
d83a3991 | 28 | */ |
29 | function civicrm_api3_word_replacement_get($params) { | |
df197a56 | 30 | return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); |
d83a3991 | 31 | } |
32 | ||
d83a3991 | 33 | /** |
9d32e6f7 | 34 | * Create a new Word Replacement. |
d83a3991 | 35 | * |
36 | * @param array $params | |
37 | * | |
38 | * @return array | |
d83a3991 | 39 | */ |
40 | function civicrm_api3_word_replacement_create($params) { | |
1237d8d7 | 41 | return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'WordReplacement'); |
d83a3991 | 42 | } |
43 | ||
44 | /** | |
0aa0303c EM |
45 | * Adjust Metadata for Create action. |
46 | * | |
47 | * The metadata is used for setting defaults, documentation & validation. | |
d83a3991 | 48 | * |
cf470720 | 49 | * @param array $params |
b081365f | 50 | * Array of parameters determined by getfields. |
d83a3991 | 51 | */ |
52 | function _civicrm_api3_word_replacement_create_spec(&$params) { | |
df197a56 | 53 | $params['find_word']['api.required'] = 1; |
54 | $params['replace_word']['api.required'] = 1; | |
55 | $params['is_active']['api.default'] = 1; | |
d83a3991 | 56 | } |
57 | ||
58 | /** | |
244bbdd8 | 59 | * Delete an existing WordReplacement. |
d83a3991 | 60 | * |
cf470720 | 61 | * @param array $params |
244bbdd8 | 62 | * Array containing id of the WordReplacement to be deleted. |
d83a3991 | 63 | * |
a6c01b45 | 64 | * @return array |
9d32e6f7 | 65 | * API result array |
d83a3991 | 66 | */ |
67 | function civicrm_api3_word_replacement_delete($params) { | |
68 | return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params); | |
e9d619eb | 69 | } |