Commit cee3518c authored by lamp5's avatar lamp5 Committed by Neslee Canil Pinto
Browse files

Issue #3152852 by lamp5: Wrong filter "active" for boolean field - regression D7

parent af5ddaf6
......@@ -215,7 +215,7 @@ function template_preprocess_bef_links(array &$variables) {
// with the entire options array and remove items from it as needed.
$urlOptions = $url->getOptions();
if (isset($element['#multiple'])) {
if (isset($element['#multiple']) && $element['#multiple']) {
$newQuery = isset($existing_query[$name]) ? $existing_query[$name] : [];
if (in_array($optionValue, $selectedValues)) {
// Allow users to toggle an option using the same link.
......@@ -234,7 +234,7 @@ function template_preprocess_bef_links(array &$variables) {
}
}
else {
if ($optionValue == $element['#value']) {
if (strval($optionValue) === $element['#value']) {
// Allow toggle link functionality -- click the same link to turn an
// option on or off.
$newQuery = $existing_query;
......@@ -270,7 +270,10 @@ function template_preprocess_bef_links(array &$variables) {
'#url' => $url,
];
if (in_array($optionValue, $selectedValues)) {
/*
* @see https://stackoverflow.com/questions/13846769/php-in-array-0-value
*/
if (in_array(strval($optionValue), $selectedValues)) {
$variables['links'][$optionValue]['#attributes']['class'][] = 'bef-link--selected';
}
}
......
Supports Markdown
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