Upgrading to 5.x breaks options_alter completely for sliders.

Created on 2 July 2021, about 3 years ago
Updated 16 May 2024, 4 months ago

I'm in the process of upgrading from 3.x to 5.x

One of the (many) headaches I'm facing is that hook_better_exposed_filters_settings_alter (which apparently has been renamed to hook_better_exposed_filters_options_alter) does nothing for the bef_filters.

The thing I want to dynamically change is the min/max values of the slider.

Looking in /src/Plugin/better_exposed_filters/filter/Sliders.php I can see that the min/max values are "hardcoded" from the configuration options:

      'min' => $this->configuration['min'],
      'max' => $this->configuration['max'],

From what I can see, hook_better_exposed_filters_options_alter does nothing now? Or, how am I meant to be using it?

The hardcoded alternative in better_exposed_filters.api.php gives this example:

function hook_better_exposed_filters_settings_alter(&$settings, $view, $displayHandler) {
  // Set the min/max value of a slider.
  $settings['field_price_value']['slider_options']['bef_slider_min'] = 500;
  $settings['field_price_value']['slider_options']['bef_slider_max'] = 5000;
}

Which also doesnt work for me (when adjusting the field name)

πŸ“Œ Task
Status

Closed: outdated

Component

Code

Created by

πŸ‡©πŸ‡°Denmark ras-ben Copenhagen

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024