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
Comment #2
jian he commentedComment #3
xanoComment #4
xanoPlease explain the requested feature in more detail. Screenshots will be helpful
Comment #5
xanoThis 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().Comment #6
xanoThis 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.Comment #9
xanoComment #10
xanoThis adds cacheability metadata and unit tests. We still need integration tests to make sure
plugin_field_views_data_alter()works.Comment #11
xano#2720813: DefaultPluginManager should expose its cacheability metadata increases the performance of the patch from #10.
Comment #14
xanoComment #15
xano#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.
Comment #16
xanoThis is a first stab at supporting single-value base fields as well. The integration is still untested.
Comment #19
xanoComment #20
xanoThis adds test coverage for the single-value base field integration.
Comment #23
xanoComment #26
xanoNow with tests for the configurable field integration as well.
Comment #27
xanoActually, 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.
Comment #28
xanoThis 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.
Comment #29
xano#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.
Comment #30
xanoThis adds support for multi-value base fields.
Comment #31
xanoComment #34
xanoComment #35
xanoWe may also need to set
PluginId->$valueTitle.Comment #36
xanoComment #37
xano