Problem/Motivation

Views exposes all fields as data sources to itself. By default, exposed filters are plain text fields which provide very basic UX.

Proposed resolution

To improve this, add a Views filter plugin for the plugin field type.

Remaining tasks

Find out how to add these filters for all base and configurable fields in hook_views_data().

User interface changes

None.

API changes

None.

Data model changes

None.

Original report

Use the plugin field as exposed views filter, only have a textfield, it's hard to input the value and filter the views data. If it can be a selector will make help.

Comments

jian he created an issue. See original summary.

jian he’s picture

Title: Provide selector widget in exposed views filter » Provide selector instead of textfield in exposed views filter
xano’s picture

Category: Bug report » Feature request
xano’s picture

Status: Active » Postponed (maintainer needs more info)

Please explain the requested feature in more detail. Screenshots will be helpful

xano’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Active

This is the default Views exposed filter, and not something the Plugin module provides. We could indeed add a Views filter plugin to improve the UX. We do need to find out how to apply this to all plugin instance fields, though. I'm not that familiar with how base and configurable fields are exposed to hook_views_data().

xano’s picture

Status: Active » Needs review
Issue tags: +Needs tests
StatusFileSize
new4.3 KB

This is a first stab that works for configurable fields only. Support for base fields must be added through hook_views_data_alter() which is less straightforward to work with.

Status: Needs review » Needs work

The last submitted patch, 6: plugin_2633800_6.patch, failed testing.

The last submitted patch, 6: plugin_2633800_6.patch, failed testing.

xano’s picture

Status: Needs work » Needs review
StatusFileSize
new734 bytes
new4.43 KB
xano’s picture

StatusFileSize
new10.45 KB
new12.92 KB

This adds cacheability metadata and unit tests. We still need integration tests to make sure plugin_field_views_data_alter() works.

xano’s picture

Title: Provide selector instead of textfield in exposed views filter » Add a Views filter for plugin fields
Related issues: +#2720813: DefaultPluginManager should expose its cacheability metadata

Status: Needs review » Needs work

The last submitted patch, 10: plugin_2633800_10.patch, failed testing.

The last submitted patch, 10: plugin_2633800_10.patch, failed testing.

xano’s picture

Status: Needs work » Needs review
StatusFileSize
new10.48 KB
new12.94 KB
xano’s picture

#2477899: Multiple valued Base fields won't work in Views prevents us from supporting this for multi-value base fields. Supporting single-value base fields should be possible, though.

xano’s picture

StatusFileSize
new5.11 KB
new15.4 KB

This is a first stab at supporting single-value base fields as well. The integration is still untested.

Status: Needs review » Needs work

The last submitted patch, 16: plugin_2633800_16.patch, failed testing.

The last submitted patch, 16: plugin_2633800_16.patch, failed testing.

xano’s picture

Status: Needs work » Needs review
StatusFileSize
new4.14 KB
new15.91 KB
xano’s picture

StatusFileSize
new10.31 KB
new24.63 KB

This adds test coverage for the single-value base field integration.

Status: Needs review » Needs work

The last submitted patch, 20: plugin_2633800_20.patch, failed testing.

The last submitted patch, 20: plugin_2633800_20.patch, failed testing.

xano’s picture

Status: Needs work » Needs review
StatusFileSize
new936 bytes
new24.29 KB

Status: Needs review » Needs work

The last submitted patch, 23: plugin_2633800_22.patch, failed testing.

The last submitted patch, 23: plugin_2633800_22.patch, failed testing.

xano’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new25.87 KB
new34.29 KB

Now with tests for the configurable field integration as well.

xano’s picture

Actually, don't call the new field filter. Try to make it more generic/abstract. Then we can display the label as the field handler, and use this new filter as well, without being in the way of the existing raw ID field which people may want to use.

xano’s picture

StatusFileSize
new7 KB
new36.04 KB

This also cleans up the filters for the field item delta and plugin configuration a bit to prevent site builders from being confused by the different filtering options that do not always work.

xano’s picture

Status: Needs review » Needs work

#2477899: Multiple valued Base fields won't work in Views was committed to 8.2.x and 8.1.x a week-and-a-half ago, so we should support it in this patch.

xano’s picture

Status: Needs work » Needs review
StatusFileSize
new46.8 KB

This adds support for multi-value base fields.

xano’s picture

StatusFileSize
new26.02 KB

Status: Needs review » Needs work

The last submitted patch, 30: plugin_2633800_30.patch, failed testing.

The last submitted patch, 30: plugin_2633800_30.patch, failed testing.

xano’s picture

Status: Needs work » Needs review
StatusFileSize
new4.52 KB
new46.91 KB
xano’s picture

We may also need to set PluginId->$valueTitle.

xano’s picture

StatusFileSize
new1.13 KB
new46.97 KB
xano’s picture

Status: Needs review » Fixed

  • Xano committed 83f8947 on 8.x-2.x
    Issue #2633800 by Xano: Add a Views filter for plugin fields.
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.