Commit 2ee28fd8 authored by AaronBauman's avatar AaronBauman Committed by Neslee Canil Pinto
Browse files

Issue #3112834 by AaronBauman, Neslee Canil Pinto: Exposed Filter Settings gone after upgrade

parent 13a455ec
......@@ -152,17 +152,20 @@ function better_exposed_filters_update_8002() {
// Go through each display on each view.
$displays = $config->get('display');
$needs_update = FALSE;
foreach ($displays as $display_name => $display) {
if (!empty($display['display_options']['exposed_form'])) {
$exposed_form = $display['display_options']['exposed_form'];
// Find BEF exposed forms.
if (isset($exposed_form['type']) && $exposed_form['type'] === 'bef') {
$bef_settings = [];
$bef_settings = $exposed_form['options']['bef'];
foreach ($exposed_form['options']['bef'] as $type => $option) {
if ($type === 'filter') {
$field_name = $type;
// Sliders.
if ($option['bef_format'] === 'bef_slider') {
$needs_update = TRUE;
// Update plugin name to 'bef_sliders'.
$bef_settings['filter'][$field_name] = [
'plugin_id' => 'bef_sliders',
......@@ -192,11 +195,14 @@ function better_exposed_filters_update_8002() {
}
// Update BEF settings.
$config->set("display.$display_name.display_options.exposed_form.options.bef", $bef_settings);
if ($needs_update) {
$config->set("display.$display_name.display_options.exposed_form.options.bef", $bef_settings);
}
}
}
}
$config->save(TRUE);
if ($needs_update) {
$config->save(TRUE);
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment