From 2f41f0fa5b236c11b966df159183120cc310c54e Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 4 Mar 2021 12:58:15 -0500 Subject: [PATCH] SearchKit - Allow variations of field suffix in display filters --- ext/search/Civi/Api4/Action/SearchDisplay/Run.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ext/search/Civi/Api4/Action/SearchDisplay/Run.php b/ext/search/Civi/Api4/Action/SearchDisplay/Run.php index 875b106527..9a890b6aa8 100644 --- a/ext/search/Civi/Api4/Action/SearchDisplay/Run.php +++ b/ext/search/Civi/Api4/Action/SearchDisplay/Run.php @@ -237,13 +237,22 @@ class Run extends \Civi\Api4\Generic\AbstractAction { } /** - * Returns an array of field names or aliases from the SELECT clause + * Returns an array of field names or aliases + allowed suffixes from the SELECT clause * @return string[] */ private function getSelectAliases() { - return array_map(function($select) { + $result = []; + $selectAliases = array_map(function($select) { return array_slice(explode(' AS ', $select), -1)[0]; }, $this->savedSearch['api_params']['select']); + foreach ($selectAliases as $alias) { + [$alias] = explode(':', $alias); + $result[] = $alias; + foreach (['name', 'label', 'abbr'] as $allowedSuffix) { + $result[] = $alias . ':' . $allowedSuffix; + } + } + return $result; } /** -- 2.25.1