Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
D8 port of #2560321: Placeholder support , patch to follow
Comment | File | Size | Author |
---|---|---|---|
#6 | better_exposed_filters-placeholder_support-2846909.patch | 2.85 KB | Gravypower |
#3 | better_exposed_filters-placeholder_support-2846909.patch | 2.8 KB | Gravypower |
Comments
Comment #2
Gravypower CreditAttribution: Gravypower commentedComment #3
Gravypower CreditAttribution: Gravypower commentedComment #4
Gravypower CreditAttribution: Gravypower commentedComment #5
Gravypower CreditAttribution: Gravypower commentedComment #6
Gravypower CreditAttribution: Gravypower commentedadded check to see if the placeholder settings exist.
Comment #7
ifrikThis patch works for me.
Comment #8
mikeker CreditAttribution: mikeker at Fuse IQ commented@Gravypower, thank you for the feature request and patch! Unfortunately, there's a fair bit more that needs to be handled when adding new options to BEF -- in this case we needed default values for easy upgrades and a schema entry so the value is translatable.
I've committed a slightly different take on this which will give them option to specify placeholder text for text-based filters (filters that extend
StringFilter
). I'm not sure if I should include filters that extendNumericFilter
as well. Please feel free to open a followup for that if you feel they should be included.Comment #11
ekes CreditAttribution: ekes as a volunteer commentedSo the schema change was important.
What was the reason to restrict the filter type to Drupal\views\Plugin\views\filter\StringFilter? I guess it only makes sense in some cases? However, I've got a filter of type Drupal\search_api\Plugin\views\filter\SearchApiFulltext which had the placeholder, and it makes sense there. I don't think it's going to be possible to list all types that it does make sense with - or is there some other way to know about the field?
Comment #12
mikeker CreditAttribution: mikeker at Fuse IQ commented@ekes, you're correct, the restriction to
StringFilter
types (and, it could be argued,NumericFilter
as well...) is to prevent the option from showing up for filters that do not support placeholders (eg: boolean).SearchAPI is somewhat problematic as they extend
FilterPluginBase
instead ofStringFilter
. There are other places in BEF where we special case SearchAPI's filters and it looks like this will be one more... Please open a new issue for this. Thanks.Comment #13
mikeker CreditAttribution: mikeker at Fuse IQ commentedForgot to credit my sponsoring company...
Comment #14
mikeker CreditAttribution: mikeker at Fuse IQ commentedFollowup: #2895536: Allow placeholder option for SearchAPI filters