Merge pull request #1080 from davecivicrm/eventPermissionNoticeFix
[civicrm-core.git] / api / v3 / OptionGroup.php
CommitLineData
6a488035 1<?php
6a488035 2
6a488035
TO
3function civicrm_api3_option_group_get($params) {
4
5 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
6}
7
8/**
9 * create/update survey
10 *
11 * This API is used to create new survey or update any of the existing
12 * In case of updating existing survey, id of that particular survey must
13 * be in $params array.
14 *
15 * @param array $params (referance) Associative array of property
16 * name/value pairs to insert in new 'survey'
17 *
18 * @return array survey array
19 *
20 * @access public
21 */
22function civicrm_api3_option_group_create($params) {
23
24 $ids = array();
25 $bao = CRM_Core_BAO_OptionGroup::add($params, $ids);
26
27 if (is_null($bao)) {
28 return civicrm_api3_create_error('Entity not created');
29 }
30 else {
31 $values = array();
32 _civicrm_api3_object_to_array($bao, $values[$bao->id]);
33 return civicrm_api3_create_success($values, $params, 'option_group', 'create', $bao);
34 }
35}
36
11e09c59 37/**
6a488035 38 * Adjust Metadata for Create action
1c88e578 39 *
6a488035
TO
40 * The metadata is used for setting defaults, documentation & validation
41 * @param array $params array or parameters determined by getfields
42 */
43function _civicrm_api3_option_group_create_spec(&$params) {
44 $params['name']['api.unique'] = 1;
45}