BEF 7.0 compatible

Created on 29 May 2024, 6 months ago

Problem/Motivation

Hello, a new version of Better Exposed Filters has been released that removes jQuery and adds type hints. The current plugin is not compatible with the new version. Error:
Fatal error: Declaration of Drupal\select2\Plugin\better_exposed_filters\filter\Select2::defaultConfiguration() must be compatible with Drupal\better_exposed_filters\Plugin\better_exposed_filters\filter\FilterWidgetBase::defaultConfiguration(): array in /var/www/web/modules/contrib/select2/src/Plugin/better_exposed_filters/filter/Select2.php on line 21

Steps to reproduce

Proposed resolution

Add type hints to the BEF Select2 plugin methods.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Feature request
Status

Active

Version

1.0

Component

Views integration

Created by

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

Merge Requests

Comments & Activities

  • Issue created by @kksandr
  • Issue was unassigned.
  • Status changed to Needs review 6 months ago
  • Pipeline finished with Failed
    6 months ago
    Total: 363s
    #185153
  • Status changed to RTBC 3 months ago
  • 🇺🇸United States smustgrave

    +1 for this. It was reported in 🐛 Nondescript error when trying to edit Exposed Form Style settings in view Active guess we can technically remove the typehints but would like to keep them if possible

  • 🇺🇦Ukraine zegmant

    the same on 7.0.1
    php8.3.10
    D10.3.2

    tried to set select2 in bef via direct editing of views config (for field_country_target_id filter)

          exposed_form:
            type: bef
            options:
              submit_button: Apply
              reset_button: true
              reset_button_label: Reset
              exposed_sorts_label: 'Sort by'
              expose_sort_order: true
              sort_asc_label: Asc
              sort_desc_label: Desc
              text_input_required: 'Select any filter and click on Apply to see results'
              text_input_required_format: null
              bef:
                general:
                  autosubmit: false
                  autosubmit_exclude_textfield: false
                  autosubmit_textfield_delay: 500
                  autosubmit_hide: false
                  input_required: false
                  allow_secondary: false
                  secondary_label: 'Advanced options'
                  secondary_open: false
                  reset_button_always_show: false
                sort:
                  plugin_id: default
                filter:
                  combine:
                    plugin_id: default
                  field_country_target_id:
                    plugin_id: bef_select2
                    advanced:
                      placeholder_text: 'Country'
                      rewrite:
                        filter_rewrite_values: ''
                        filter_rewrite_values_key: false
                      collapsible: false
                      collapsible_disable_automatic_open: false
                      is_secondary: false

    when viewing the page frontend it goes into the same error:

    Fatal error: Declaration of Drupal\select2\Plugin\better_exposed_filters\filter\Select2::defaultConfiguration() must be compatible with Drupal\better_exposed_filters\Plugin\better_exposed_filters\filter\FilterWidgetBase::defaultConfiguration(): array in /var/www/unh-new/web/modules/contrib/select2/src/Plugin/better_exposed_filters/filter/Select2.php on line 74

    changing
    public function defaultConfiguration(): array { to public function defaultConfiguration() { gives no reluslts

  • 🇧🇪Belgium JeroenT 🇧🇪

    🐛 Compatibility with Better Exposed Filters 7 RTBC is a duplicate of this issue.

  • 🇨🇦Canada endless_wander

    Patch in https://www.drupal.org/project/select2/issues/3482698#comment-15827078 🐛 Select2 Plugin is not compatible with BEF plugin Active fixes this issue for me in BEF 7.*

Production build 0.71.5 2024