Improve field, filter, argument and sort types for views

Created on 1 July 2024, 6 months ago
Updated 17 August 2024, 4 months ago

Problem/Motivation

For selection fields (dropdown select or radio buttons), widget and formatters are not used in views.

Steps to reproduce

Define a select subfield with label/value pairs and create a view to display the custom field:
-) values are shown instead of labels
-) exposed filters display values instead of labels

Proposed resolution

Integrate custom field formatters and widgets into views

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇮🇹Italy giuse69

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @giuse69
  • First commit to issue fork.
  • 🇺🇸United States apmsooner

    All of these views fields are just currently using the standard plugins. Thanks for raising this issue. I will work on some conditions to get all of these into the correct plugin format.

  • 🇺🇸United States apmsooner

    Unfortunately, providing widgets for select and radios exposed filters is not gonna be doable for the fact that the widget settings may be different across bundle types. For example, one bundle may be using simple text input widget while another of the same field may be using the select widget so theres no way of supporting both in a single filter. I can however improve the field, filter, sort and argument types to at least map up to the proper data types with the exception of datetime type as thats a more complex case that would require custom plugins similar to the datetime module in core.

  • 🇺🇸United States apmsooner

    Renaming title to account for what we can do now for this issue.

  • Merge request !55Resolve #3458270 "Select field formatter" → (Merged) created by apmsooner
  • Pipeline finished with Skipped
    5 months ago
    #230774
    • apmsooner committed 42e95d1d on 3.0.x
      Issue #3458270 by apmsooner: Improve field, filter, argument and sort...
  • Status changed to Fixed 5 months ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • 🇮🇹Italy giuse69

    I updated the module to RC4 but I can't seem that it is solved: I created a subfield (in a custom field) with integer as storage and labels mapping in the form for the different values.
    The display and the form display are correct and show the labels instead of the integer (but it was like that already in RC3), in views the integer value is displayed and not the label.
    Anything I have to configure specifically for that?
    thanks!

    Giuse

  • 🇺🇸United States apmsooner

    Hi, I enhanced the filters as much as possible however I can't make the filter work as a dropdown as described in this comment: https://www.drupal.org/project/custom_field/issues/3458270#comment-15693445 🐛 Improve field, filter, argument and sort types for views Fixed . You see a custom field can have the same field and property names across multiple content types but have different widgets. This is different than core's list_string field type that explicitly has the same storage but also restrictions for widgets to always be options. Sorry but I just can't accommodate this views filter for that reason of inconsistent widget settings. You could probably add your own hook to get what you're after but I just can't do it as a general module feature.

  • 🇮🇹Italy giuse69

    Hi, and at least having the option of displaying the label of the (sub)field instead of its value (so something like a formatter option that reads the labels from the settings of the custom field) would be possible?
    thanks

  • 🇺🇸United States apmsooner

    Not as individual subfield setting for the same reasons but the custom field itself is available in views that has the same format settings as on the entity manage display page where that option is possible. That may or may not work for you depending on how you want to display everything. Again, you can alter these in code. I just can't support it in a general sense. A future feature enhancement could be to make specific subfield types like list_string, list_integer similar to core which would lock those into an options list. I myself have other higher priorities to work on however with the module for now.

Production build 0.71.5 2024