SearchKit - Fix Campaign, State, Country selectors (again)
authorColeman Watts <coleman@civicrm.org>
Fri, 25 Nov 2022 16:35:35 +0000 (11:35 -0500)
committerColeman Watts <coleman@civicrm.org>
Fri, 25 Nov 2022 16:35:39 +0000 (11:35 -0500)
commit5511ef1e62ad75398843004926e5aa389dfeefb5
tree99c4b1f366a906ae387f5ecca658104b0b7e96fd
parent5f91da4b61d32858b57bcf091886a4cf917d2fdb
SearchKit - Fix Campaign, State, Country selectors (again)

This fixes the attempted fix from 7deb8c37 which broke more than it fixed.

The goal was to use ajax to load state, country & county lists because they are too long to prefetch.
But switching ALL FK fields to use ajax instead of option suffixes was too heavy-handed and would
have broken a lot of existing searches by no longer supporting those pseudoconstants in the UI.

This restores all previous option list fields, and targets only address country/county/state fields.
Ideally we'd turn the prefetch flag off on those fields but that would have major consequenses for
formBuilder and existing searches.
So this uses a subtler approach and tweaks their "suffixes" metadata to remove :name which didn't really
make sense for those fields anyway since they don't actually have machine names.
Then it teaches SearchKit to use ajax for selecting from fields with no :name, while still using :label
for their display value in the table.
Civi/Api4/Service/Spec/Provider/AddressGetSpecProvider.php
ext/search_kit/ang/crmSearchAdmin.module.js
ext/search_kit/ang/crmSearchAdmin/crmSearchAdmin.component.js
ext/search_kit/ang/crmSearchTasks/crmSearchInput/crmSearchInputVal.component.js