SearchKit - Change @searchable annotation from boolean to option list
[civicrm-core.git] / Civi / Api4 / CustomValue.php
index 9cc2e5f753e937dadc2738b60a6157583b5d996b..40b4d96160814290585125f1c32e6c7639f70c60 100644 (file)
@@ -16,7 +16,6 @@
  * @copyright CiviCRM LLC https://civicrm.org/licensing
  */
 
-
 namespace Civi\Api4;
 
 /**
@@ -104,27 +103,28 @@ class CustomValue {
   /**
    * @param string $customGroup
    * @param bool $checkPermissions
-   * @return Action\CustomValue\Replace
+   * @return Generic\BasicReplaceAction
    * @throws \API_Exception
    */
   public static function replace($customGroup, $checkPermissions = TRUE) {
-    return (new Action\CustomValue\Replace($customGroup, __FUNCTION__))
+    return (new Generic\BasicReplaceAction("Custom_$customGroup", __FUNCTION__, ['id', 'entity_id']))
       ->setCheckPermissions($checkPermissions);
   }
 
   /**
    * @param string $customGroup
    * @param bool $checkPermissions
-   * @return Action\CustomValue\GetActions
+   * @return Action\GetActions
    * @throws \API_Exception
    */
   public static function getActions($customGroup = NULL, $checkPermissions = TRUE) {
-    return (new Action\CustomValue\GetActions($customGroup, __FUNCTION__))
+    return (new Action\GetActions("Custom_$customGroup", __FUNCTION__))
       ->setCheckPermissions($checkPermissions);
   }
 
   /**
-   * @inheritDoc
+   * @see \Civi\Api4\Generic\AbstractEntity::permissions()
+   * @return array
    */
   public static function permissions() {
     $entity = 'contact';
@@ -134,4 +134,20 @@ class CustomValue {
     return \CRM_Utils_Array::value($entity, $permissions, []) + $permissions['default'];
   }
 
+  /**
+   * @see \Civi\Api4\Generic\AbstractEntity::getInfo()
+   * @return array
+   */
+  public static function getInfo() {
+    return [
+      'class' => __CLASS__,
+      'type' => ['CustomValue'],
+      'searchable' => 'secondary',
+      'see' => [
+        'https://docs.civicrm.org/user/en/latest/organising-your-data/creating-custom-fields/#multiple-record-fieldsets',
+        '\Civi\Api4\CustomGroup',
+      ],
+    ];
+  }
+
 }