3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
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 +--------------------------------------------------------------------+
13 * This api exposes CiviCRM GroupNesting.
15 * This defines parent/child relationships between nested groups.
17 * @package CiviCRM_APIv3
21 * Provides group nesting record(s) given parent and/or child id.
23 * @param array $params
24 * An array containing at least child_group_id or parent_group_id.
27 * list of group nesting records
29 function civicrm_api3_group_nesting_get($params) {
30 return _civicrm_api3_basic_get('CRM_Contact_DAO_GroupNesting', $params);
34 * Creates group nesting record for given parent and child id.
36 * Parent and child groups need to exist.
38 * @param array $params
39 * Parameters array - allowed array keys include:.
44 function civicrm_api3_group_nesting_create($params) {
45 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__
), $params, 'GroupNesting');
49 * Adjust Metadata for Create action.
51 * The metadata is used for setting defaults, documentation & validation.
53 * @param array $params
54 * Array of parameters determined by getfields.
56 function _civicrm_api3_group_nesting_create_spec(&$params) {
57 $params['child_group_id']['api.required'] = 1;
58 $params['parent_group_id']['api.required'] = 1;
62 * Removes specific nesting records.
64 * @param array $params
67 * API Success or fail array
69 * @todo Work out the return value.
71 function civicrm_api3_group_nesting_delete($params) {
72 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__
), $params);