Merge pull request #20741 from civicrm/5.39
[civicrm-core.git] / Civi / Api4 / CustomValue.php
index 8b9b3411dbee39b40812966521e0c02d5d34be26..bd1705d06592314eabd3c39e1cab5c6c2a26ac7b 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /*
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC. All rights reserved.                        |
@@ -9,13 +8,6 @@
  | and copyright information, see https://civicrm.org/licensing       |
  +--------------------------------------------------------------------+
  */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC https://civicrm.org/licensing
- */
-
 namespace Civi\Api4;
 
 /**
@@ -122,6 +114,13 @@ class CustomValue {
       ->setCheckPermissions($checkPermissions);
   }
 
+  /**
+   * @return \Civi\Api4\Generic\CheckAccessAction
+   */
+  public static function checkAccess($customGroup) {
+    return new Generic\CheckAccessAction("Custom_$customGroup", __FUNCTION__);
+  }
+
   /**
    * @see \Civi\Api4\Generic\AbstractEntity::permissions()
    * @return array
@@ -142,7 +141,8 @@ class CustomValue {
     return [
       'class' => __CLASS__,
       'type' => ['CustomValue'],
-      'searchable' => TRUE,
+      'searchable' => 'secondary',
+      'id_field' => 'id',
       'see' => [
         'https://docs.civicrm.org/user/en/latest/organising-your-data/creating-custom-fields/#multiple-record-fieldsets',
         '\Civi\Api4\CustomGroup',