Merge pull request #17656 from civicrm/5.27
[civicrm-core.git] / api / v3 / Dashboard.php
CommitLineData
15d9b3ae 1<?php
15d9b3ae
N
2/*
3 +--------------------------------------------------------------------+
a30c801b 4 | Copyright CiviCRM LLC. All rights reserved. |
15d9b3ae 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 |
15d9b3ae
N
9 +--------------------------------------------------------------------+
10 */
11
12/**
c28e1768 13 * This api exposes CiviCRM Dashboard.
15d9b3ae
N
14 *
15 * @package CiviCRM_APIv3
15d9b3ae
N
16 */
17
15d9b3ae
N
18/**
19 * Creates or updates an Dashlet.
20 *
cf470720 21 * @param array $params
15d9b3ae 22 *
a6c01b45 23 * @return array
72b3a70c 24 * Array containing 'is_error' to denote success or failure and details of the created activity
15d9b3ae
N
25 */
26function civicrm_api3_dashboard_create($params) {
cf8f0fff 27 civicrm_api3_verify_one_mandatory($params, NULL, [
7c31ae57
SL
28 'name',
29 'label',
30 'url',
31 'fullscreen_url',
32 ]);
3cfa8e5e 33 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Dashboard');
15d9b3ae
N
34}
35
36/**
22242c87
EM
37 * Specify Meta data for create.
38 *
39 * Note that this data is retrievable via the getfields function
15d9b3ae 40 * and is used for pre-filling defaults and ensuring mandatory requirements are met.
22242c87 41 *
cf470720 42 * @param array $params
22242c87 43 * array of parameters determined by getfields.
15d9b3ae
N
44 */
45function _civicrm_api3_dashboard_create_spec(&$params) {
3f14cb24 46 $params['is_active']['api.default'] = 1;
15d9b3ae
N
47 unset($params['version']);
48}
49
50/**
d1b0d05e 51 * Gets a CiviCRM Dashlets according to parameters.
15d9b3ae 52 *
cf470720 53 * @param array $params
15d9b3ae
N
54 *
55 * @return array
15d9b3ae
N
56 */
57function civicrm_api3_dashboard_get($params) {
a25b46e9 58 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
15d9b3ae
N
59}
60
61/**
62 * Delete a specified Dashlet.
63 *
cf470720 64 * @param array $params
c23f45d3 65 * Array holding 'id' of dashlet to be deleted.
c23f45d3 66 * @return array
8089541a 67 * @throws API_Exception
a279e546 68 * @throws CiviCRM_API3_Exception
15d9b3ae
N
69 */
70function civicrm_api3_dashboard_delete($params) {
a279e546 71 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
a7488080 72}