From 53f1708dc0776278b50dd0789d556bc95a4836b8 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 16 Nov 2022 12:37:52 -0500 Subject: [PATCH] Customize default display for Countries --- .../CountryAutocompleteProvider.php | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Civi/Api4/Service/Autocomplete/CountryAutocompleteProvider.php diff --git a/Civi/Api4/Service/Autocomplete/CountryAutocompleteProvider.php b/Civi/Api4/Service/Autocomplete/CountryAutocompleteProvider.php new file mode 100644 index 000000000000..d047bbcb3698 --- /dev/null +++ b/Civi/Api4/Service/Autocomplete/CountryAutocompleteProvider.php @@ -0,0 +1,50 @@ +display['settings'] || $e->display['type'] !== 'autocomplete' || $e->savedSearch['api_entity'] !== 'Country') { + return; + } + $e->display['settings'] = [ + 'sort' => [ + ['name', 'ASC'], + ], + 'columns' => [ + [ + 'type' => 'field', + 'key' => 'name', + ], + [ + 'type' => 'field', + 'key' => 'iso_code', + ], + ], + ]; + } + +}