4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
7 | This work is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
10 +--------------------------------------------------------------------+
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
23 * Provides virtual api entities for every multi-record custom group.
25 * This class is different from other apis in that it is not itself an entity, but allows every
26 * multi-record custom group to act like an entity.
28 * Each action takes the name of the custom group as a parameter, or in traditional syntax the entity is prefixed with 'Custom_'
30 * **Ex. OOP:** `\Civi\Api4\CustomValue::get('MyStuff')->addWhere('id', '=', 123);`
31 * **Non-OOP:** `civicrm_api4('Custom_MyStuff', 'get', ['where' => [['id', '=', 123]]]);`
33 * Note: This class does NOT extend AbstractEntity so it doesn't get mistaken for a "real" entity.
39 * @param string $customGroup
40 * @return Action\CustomValue\Get
41 * @throws \API_Exception
43 public static function get($customGroup) {
44 return new Action\CustomValue\
Get($customGroup, __FUNCTION__
);
48 * @param string $customGroup
49 * @return Action\CustomValue\GetFields
50 * @throws \API_Exception
52 public static function getFields($customGroup = NULL) {
53 return new Action\CustomValue\
GetFields($customGroup, __FUNCTION__
);
57 * @param string $customGroup
58 * @return Action\CustomValue\Save
59 * @throws \API_Exception
61 public static function save($customGroup) {
62 return new Action\CustomValue\
Save($customGroup, __FUNCTION__
);
66 * @param string $customGroup
67 * @return Action\CustomValue\Create
68 * @throws \API_Exception
70 public static function create($customGroup) {
71 return new Action\CustomValue\
Create($customGroup, __FUNCTION__
);
75 * @param string $customGroup
76 * @return Action\CustomValue\Update
77 * @throws \API_Exception
79 public static function update($customGroup) {
80 return new Action\CustomValue\
Update($customGroup, __FUNCTION__
);
84 * @param string $customGroup
85 * @return Action\CustomValue\Delete
86 * @throws \API_Exception
88 public static function delete($customGroup) {
89 return new Action\CustomValue\
Delete($customGroup, __FUNCTION__
);
93 * @param string $customGroup
94 * @return Action\CustomValue\Replace
95 * @throws \API_Exception
97 public static function replace($customGroup) {
98 return new Action\CustomValue\
Replace($customGroup, __FUNCTION__
);
102 * @param string $customGroup
103 * @return Action\CustomValue\GetActions
104 * @throws \API_Exception
106 public static function getActions($customGroup = NULL) {
107 return new Action\CustomValue\
GetActions($customGroup, __FUNCTION__
);
113 public static function permissions() {
115 $permissions = \CRM_Core_Permission
::getEntityActionPermissions();
117 // Merge permissions for this entity with the defaults
118 return \CRM_Utils_Array
::value($entity, $permissions, []) +
$permissions['default'];