- πΊπΈUnited States m.stenta
Update: Drupal core has merged an official fix for this in 11.x. We are using that now in farmOS, as of our upgrade to Drupal 10.3. See: Update Drupal core to 10.3 #872
Relevant notes from the PR:
Views Entity Reference filters patch
Drupal core has merged Issue #3347343: Add Views EntityReference filter to support better UX for exposed filters into Drupal 11 upstream, and they are working on a backport to Drupal 10.4. The merged changes differ slightly from the earlier patch we were using, but the end result is the same. The core maintainers decided that it would be a breaking change if they took the approach from the patch(es) we were previously using. The existing (and still default) Views entity reference filter only works with entity IDs (not selects or autocompletes), and the previous patches replaced this with select/autocomplete. This means that any existing sites that depended on entity ID filtering would break. So, the core maintainers decided to add the select/autocomplete filter as an optional plugin, which will be selectable in the Views UI once some other core issues are merged (specifically #3458099: Views handler loading should respect configuration and #3438054: Configurable views filters to allow for different widgets). In the meantime, a contrib module has been published which provides the ability for site administrators to opt-in to using the new filter (Views Core Entity Reference). The alternative to using this module is to perform the same logic it does manually via
hook_views_data_alter()
. This is the approach that this PR takes via our existinghook_views_data_alter()
implementation in thefarm_ui_views
module. Once the remaining two core issues are merged, we will be able to remove that and configure the filter directly in individual Views configuration YML.Notably, the patch we are applying for 10.3 is being included directly in the farmOS codebase (in a new
patches
directory), because there isn't one available in the issue itself, and I didn't want to add more noise to an already very long core issue. I produced the patch by saving the diff of the 3347343-10-3-x--comment-214-onwards--do-not-merge MR branch: https://git.drupalcode.org/project/drupal/-/merge_requests/9036.diffSo the remaining task here is just to remove the remaining logic from
farm_ui_views_views_data_alter()
and configure it in our Views YML directly.Here is the code that will be removed: https://github.com/farmOS/farmOS/blob/a18dff81390b82b8665cb25a86267bc368...
Leaving this as postponed, and linking to the relevant upstream issues we're waiting on. I also updated the issue description.