Merge pull request #15590 from alifrumin/subjecthelp
[civicrm-core.git] / Civi / Api4 / CustomValue.php
1 <?php
2
3 /*
4 +--------------------------------------------------------------------+
5 | CiviCRM version 5 |
6 +--------------------------------------------------------------------+
7 | Copyright CiviCRM LLC (c) 2004-2019 |
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
10 | |
11 | CiviCRM is free software; you can copy, modify, and distribute it |
12 | under the terms of the GNU Affero General Public License |
13 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | |
15 | CiviCRM is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. |
19 | |
20 | You should have received a copy of the GNU Affero General Public |
21 | License and the CiviCRM Licensing Exception along |
22 | with this program; if not, contact CiviCRM LLC |
23 | at info[AT]civicrm[DOT]org. If you have questions about the |
24 | GNU Affero General Public License or the licensing of CiviCRM, |
25 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
26 +--------------------------------------------------------------------+
27 */
28
29 /**
30 *
31 * @package CRM
32 * @copyright CiviCRM LLC (c) 2004-2019
33 * $Id$
34 *
35 */
36
37
38 namespace Civi\Api4;
39
40 /**
41 * CustomGroup entity.
42 *
43 * @package Civi\Api4
44 */
45 class CustomValue extends Generic\AbstractEntity {
46
47 /**
48 * @param string $customGroup
49 * @return Action\CustomValue\Get
50 */
51 public static function get($customGroup) {
52 return new Action\CustomValue\Get($customGroup, __FUNCTION__);
53 }
54
55 /**
56 * @param string $customGroup
57 * @return Action\CustomValue\GetFields
58 */
59 public static function getFields($customGroup = NULL) {
60 return new Action\CustomValue\GetFields($customGroup, __FUNCTION__);
61 }
62
63 /**
64 * @param string $customGroup
65 * @return Action\CustomValue\Save
66 */
67 public static function save($customGroup) {
68 return new Action\CustomValue\Save($customGroup, __FUNCTION__);
69 }
70
71 /**
72 * @param string $customGroup
73 * @return Action\CustomValue\Create
74 */
75 public static function create($customGroup) {
76 return new Action\CustomValue\Create($customGroup, __FUNCTION__);
77 }
78
79 /**
80 * @param string $customGroup
81 * @return Action\CustomValue\Update
82 */
83 public static function update($customGroup) {
84 return new Action\CustomValue\Update($customGroup, __FUNCTION__);
85 }
86
87 /**
88 * @param string $customGroup
89 * @return Action\CustomValue\Delete
90 */
91 public static function delete($customGroup) {
92 return new Action\CustomValue\Delete($customGroup, __FUNCTION__);
93 }
94
95 /**
96 * @param string $customGroup
97 * @return Action\CustomValue\Replace
98 */
99 public static function replace($customGroup) {
100 return new Action\CustomValue\Replace($customGroup, __FUNCTION__);
101 }
102
103 /**
104 * @param string $customGroup
105 * @return Action\CustomValue\GetActions
106 */
107 public static function getActions($customGroup = NULL) {
108 return new Action\CustomValue\GetActions($customGroup, __FUNCTION__);
109 }
110
111 /**
112 * @inheritDoc
113 */
114 public static function permissions() {
115 $entity = 'contact';
116 $permissions = \CRM_Core_Permission::getEntityActionPermissions();
117
118 // Merge permissions for this entity with the defaults
119 return \CRM_Utils_Array::value($entity, $permissions, []) + $permissions['default'];
120 }
121
122 }