Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
better_exposed_filters
Commits
cf286883
Commit
cf286883
authored
Jan 30, 2021
by
Etroid
Committed by
Neslee Canil Pinto
Jan 30, 2021
Browse files
Issue #3158216 by Etroid: bef_slider plugin does not exists
parent
324bb4eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
better_exposed_filters.install
View file @
cf286883
...
...
@@ -91,7 +91,12 @@ function better_exposed_filters_update_8001() {
}
// Sliders.
if
(
$option
[
'bef_format'
]
===
'bef_sliders'
)
{
if
(
$option
[
'bef_format'
]
===
'bef_slider'
)
{
// Update plugin name to 'bef_sliders'.
$bef_settings
[
'filter'
][
$field_name
]
=
[
'plugin_id'
=>
'bef_sliders'
,
];
// Animate option is now split into two separate options.
$animate
=
$option
[
'slider_options'
][
'bef_slider_animate'
];
$animate_ms
=
0
;
...
...
@@ -136,3 +141,62 @@ function better_exposed_filters_update_8001() {
$config
->
save
(
TRUE
);
}
}
/**
* Renames bef_slider plugin to bef_sliders to be compatible with 8.x-4.x.
*/
function
better_exposed_filters_update_8002
()
{
$config_factory
=
\
Drupal
::
configFactory
();
foreach
(
$config_factory
->
listAll
(
'views.view.'
)
as
$config_name
)
{
$config
=
$config_factory
->
getEditable
(
$config_name
);
// Go through each display on each view.
$displays
=
$config
->
get
(
'display'
);
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
=
[];
foreach
(
$exposed_form
[
'options'
][
'bef'
]
as
$type
=>
$option
)
{
if
(
$type
===
'filter'
)
{
$field_name
=
$type
;
// Sliders.
if
(
$option
[
'bef_format'
]
===
'bef_slider'
)
{
// Update plugin name to 'bef_sliders'.
$bef_settings
[
'filter'
][
$field_name
]
=
[
'plugin_id'
=>
'bef_sliders'
,
];
// Animate option is now split into two separate options.
$animate
=
$option
[
'slider_options'
][
'bef_slider_animate'
];
$animate_ms
=
0
;
if
(
empty
(
$animate
))
{
$animate
=
'none'
;
}
elseif
(
is_int
(
$animate
))
{
$animate
=
'custom'
;
$animate_ms
=
$animate
;
}
$bef_settings
[
'filter'
][
$field_name
]
=
array_merge
(
$bef_settings
[
'filter'
][
$field_name
],
[
'min'
=>
$option
[
'slider_options'
][
'bef_slider_min'
]
??
0
,
'max'
=>
$option
[
'slider_options'
][
'bef_slider_max'
]
??
99999
,
'step'
=>
$option
[
'slider_options'
][
'bef_slider_step'
]
??
1
,
'animate'
=>
$animate
,
'animate_ms'
=>
$animate_ms
,
'orientation'
=>
$option
[
'slider_options'
][
'bef_slider_orientation'
]
??
'horizontal'
,
]);
}
}
}
// Update BEF settings.
$config
->
set
(
"display.
$display_name
.display_options.exposed_form.options.bef"
,
$bef_settings
);
}
}
}
$config
->
save
(
TRUE
);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment