Add CONCAT_WS fn to APIv4 and UI support in SearchKit
[civicrm-core.git] / Civi / Api4 / Query / SqlFunctionCOALESCE.php
index 584f4374ec774015b594668f842a123e08563e2b..5264e04ef1432beeb220bed94daf4db6860eab86 100644 (file)
@@ -18,12 +18,20 @@ class SqlFunctionCOALESCE extends SqlFunction {
 
   protected static $category = self::CATEGORY_COMPARISON;
 
-  protected static $params = [
-    [
-      'expr' => 99,
-      'optional' => FALSE,
-    ],
-  ];
+  protected static $dataType = 'String';
+
+  protected static function params(): array {
+    return [
+      [
+        'max_expr' => 99,
+        'optional' => FALSE,
+        'ui_defaults' => [
+          ['type' => 'SqlField', 'placeholder' => ts('If')],
+          ['type' => 'SqlField', 'placeholder' => ts('Else')],
+        ],
+      ],
+    ];
+  }
 
   /**
    * @return string
@@ -32,4 +40,11 @@ class SqlFunctionCOALESCE extends SqlFunction {
     return ts('Coalesce');
   }
 
+  /**
+   * @return string
+   */
+  public static function getDescription(): string {
+    return ts('The first value that is not null.');
+  }
+
 }