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
25 * Provides virtual api entities for every multi-record custom group.
27 * This class is different from other apis in that it is not itself an entity, but allows every
28 * multi-record custom group to act like an entity.
30 * Each action takes the name of the custom group as a parameter, or in traditional syntax the entity is prefixed with 'Custom_'
32 * **Ex. OOP:** `\Civi\Api4\CustomValue::get('MyStuff')->addWhere('id', '=', 123);`
33 * **Non-OOP:** `civicrm_api4('Custom_MyStuff', 'get', ['where' => [['id', '=', 123]]]);`
35 * Note: This class does NOT extend AbstractEntity so it doesn't get mistaken for a "real" entity.
41 * @param string $customGroup
42 * @return Action\CustomValue\Get
43 * @throws \API_Exception
45 public static function get($customGroup) {
46 return new Action\CustomValue\
Get($customGroup, __FUNCTION__
);
50 * @param string $customGroup
51 * @return Action\CustomValue\GetFields
52 * @throws \API_Exception
54 public static function getFields($customGroup = NULL) {
55 return new Action\CustomValue\
GetFields($customGroup, __FUNCTION__
);
59 * @param string $customGroup
60 * @return Action\CustomValue\Save
61 * @throws \API_Exception
63 public static function save($customGroup) {
64 return new Action\CustomValue\
Save($customGroup, __FUNCTION__
);
68 * @param string $customGroup
69 * @return Action\CustomValue\Create
70 * @throws \API_Exception
72 public static function create($customGroup) {
73 return new Action\CustomValue\
Create($customGroup, __FUNCTION__
);
77 * @param string $customGroup
78 * @return Action\CustomValue\Update
79 * @throws \API_Exception
81 public static function update($customGroup) {
82 return new Action\CustomValue\
Update($customGroup, __FUNCTION__
);
86 * @param string $customGroup
87 * @return Action\CustomValue\Delete
88 * @throws \API_Exception
90 public static function delete($customGroup) {
91 return new Action\CustomValue\
Delete($customGroup, __FUNCTION__
);
95 * @param string $customGroup
96 * @return Action\CustomValue\Replace
97 * @throws \API_Exception
99 public static function replace($customGroup) {
100 return new Action\CustomValue\
Replace($customGroup, __FUNCTION__
);
104 * @param string $customGroup
105 * @return Action\CustomValue\GetActions
106 * @throws \API_Exception
108 public static function getActions($customGroup = NULL) {
109 return new Action\CustomValue\
GetActions($customGroup, __FUNCTION__
);
115 public static function permissions() {
117 $permissions = \CRM_Core_Permission
::getEntityActionPermissions();
119 // Merge permissions for this entity with the defaults
120 return \CRM_Utils_Array
::value($entity, $permissions, []) +
$permissions['default'];