Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294800

Continuation Add Views EntityReference filter to be available for all entity reference fields

$
0
0

Continuation of #2429699: Add Views EntityReference filter to be available for all entity reference fields since there were so many comments the page was struggling to load.

Slack thread

https://drupal.slack.com/archives/C6SQM2J94/p1706633005193429

Problem/Motivation

One major piece of functionality from the D7 Entity Reference module was left out entirely in #1801304: Add Entity reference field: the ability to render exposed views filters as a select list or autocomplete of available entities.

Proposed resolution

Create a new Views Entity Reference filter plugin to be available for all entity reference fields and migrate the existing taxonomy filters to be based on the new generic filter plugin.

How to use

  1. Add on an entity type / bundle an entity reference field, ex field_test_reference.
  2. Create a view displaying this entity type.
  3. Add a filter on the view for field_test_reference.
  4. Configure the entity selection mode and the widget display mode.
  5. Configure the filter behavior (ex: required, multiple, etc.)
  6. Finally use the filter field for filtering the results based on the selected entity from the autocomplete or select list.

Remaining tasks

  • ☑ support for content entity reference
  • ☑ support for configuration entity reference
  • ☑ support for content with and without bundles
  • ☑ support for base fields
  • ☑ taxonomy filter rebased on generic entity reference
  • ☑ settings forms to configure the filter
  • ☑ display widget in select or autocomplete
  • ☑ filter values based on reference view
  • ☑ filter values based on bundles
  • ☑ maximum filter values in select list for performance concerns
  • ☑ sort for filter values when in bundle selection handler mode
  • ☑ argument support for when view selection handler is used
  • ☑ views configuration schema update
  • ☐ existing configuration migration (no longer needed if we create a new filter only)
  • ☐ fix select option (#208, #215)
  • ☑ tests for general functionality
  • ☑ tests support for base fields
  • ☐ Address points in comment #49 (comment 534 from original ticket)
    • ☑ add test coverage for calculate dependencies
    • ☐ sort by empty on initial load (needs more info), see comment #49
    • ☐ prevent circular reference: validate no selection of an entity reference that uses itself as the filter, see comment #49
    • ☐ node titles in the select options when configuring the filter are double escaped (e.g. " shows as "), see comment #49
    • ☐ exposed filters on the chosen entity reference view are also shown on the view, see comment #49
  • ☐ get framework manager approval
  • ☑ write change record

Post tasks

  • ☐ follow-up task for TaxonomyIndexTid
    #3339738: Convert TaxonomyIndexTid to use new EntityReference filter
  • ☐ conversion of the "authored by" filter to use the entity reference filter (now covered since base fields are now supported)
  • ☐ extract selection handler form logic in separate plugins that will specialize for rendering and validating the filter selection config form
  • ☐ caching of the value form?
  • ☐ documentation updates
  • ☐ set up deprecation of existing filter, removing this 'as a Reference' suffix

User interface

UI
UI

UIUI

Known issues

  • CANNOT REPRODUCE ATM sometimes when switching between widget it gets stuck on the previous selected one
  • FIXED when switching between the widget types the previous value is left in the exposed form and it's incompatible with the other widget type
  • FIXED triggering ajax requests on the extra options form right after adding the filter brings you back to the add handler form fixed

API changes

None.


Viewing all articles
Browse latest Browse all 294800

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>