From 297c81b7b43d05b0fc3fbec6f9d0803f1a02e87f Mon Sep 17 00:00:00 2001 From: Jamie McClelland Date: Tue, 17 Nov 2026 12:23:07 -0500 Subject: [PATCH 1/2] show counties with name of state --- .../CountyAutocompleteProvider.php | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Civi/Api4/Service/Autocomplete/CountyAutocompleteProvider.php diff --git a/Civi/Api4/Service/Autocomplete/CountyAutocompleteProvider.php b/Civi/Api4/Service/Autocomplete/CountyAutocompleteProvider.php new file mode 100644 index 000000000000..5cf84972dd46 --- /dev/null +++ b/Civi/Api4/Service/Autocomplete/CountyAutocompleteProvider.php @@ -0,0 +1,47 @@ +display['settings'] || $e->display['type'] !== 'autocomplete' || $e->savedSearch['api_entity'] !== 'County') { + return; + } + $e->display['settings'] = [ + 'sort' => [ + ['name', 'ASC'], + ], + 'columns' => [ + [ + 'type' => 'field', + 'key' => 'name', + ], + [ + 'type' => 'field', + 'key' => 'state_province_id.name', + ], + ], + ]; + } + +} From 0fad6299f9ef1b220b676c45469001306c90acea Mon Sep 17 00:00:00 2001 From: Jamie McClelland Date: Tue, 17 Nov 2026 15:04:55 -0500 Subject: [PATCH 2/2] add country to description --- .../Service/Autocomplete/CountyAutocompleteProvider.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Civi/Api4/Service/Autocomplete/CountyAutocompleteProvider.php b/Civi/Api4/Service/Autocomplete/CountyAutocompleteProvider.php index 5cf84972dd46..cf0f3499ffba 100644 --- a/Civi/Api4/Service/Autocomplete/CountyAutocompleteProvider.php +++ b/Civi/Api4/Service/Autocomplete/CountyAutocompleteProvider.php @@ -36,9 +36,15 @@ public static function on_civi_search_defaultDisplay(GenericHookEvent $e) { 'type' => 'field', 'key' => 'name', ], + [ + 'type' => 'field', + 'key' => 'name', + 'rewrite' => '[name], [state_province_id.abbr]', + ], [ 'type' => 'field', 'key' => 'state_province_id.name', + 'rewrite' => '[state_province_id.name], [state_province_id.country_id.iso_code]', ], ], ];