X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=Civi%2FApi4%2FQuery%2FSqlFunctionCOALESCE.php;h=5264e04ef1432beeb220bed94daf4db6860eab86;hb=2929fd34b84a1b3d5ebbba8855f01b9f73363dd0;hp=324d62fecf761c4ded7078729b54111141ab6281;hpb=dcb15bd30b17f2cf96d6effcccf5c9c33edce3f6;p=civicrm-core.git diff --git a/Civi/Api4/Query/SqlFunctionCOALESCE.php b/Civi/Api4/Query/SqlFunctionCOALESCE.php index 324d62fecf..5264e04ef1 100644 --- a/Civi/Api4/Query/SqlFunctionCOALESCE.php +++ b/Civi/Api4/Query/SqlFunctionCOALESCE.php @@ -18,12 +18,20 @@ class SqlFunctionCOALESCE extends SqlFunction { protected static $category = self::CATEGORY_COMPARISON; - protected static $params = [ - [ - 'max_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 @@ -33,16 +41,10 @@ class SqlFunctionCOALESCE extends SqlFunction { } /** - * Prevent reformatting - * - * @see \Civi\Api4\Utils\FormattingUtil::formatOutputValues - * @param string $value - * @param string $dataType - * @return string|array + * @return string */ - public function formatOutputValue($value, &$dataType) { - $dataType = NULL; - return $value; + public static function getDescription(): string { + return ts('The first value that is not null.'); } }