When editing the 'Rewrite filter options', the help text states:

Use this field to rewrite the filter options displayed. Use the format of current_value|replacement_value, one replacement per line. For example:

0|Zero
1|One
2|Two

However, if you do actually try to use the 0|Zero replacement, it won't be applied.

Looking through the code, the following lines in better_exposed_filters_exposed_form_plugin.inc prevent any empty values from being re-written:

if (!empty($search)) {
  $rewrite[$search] = $replace;
}

The check for empty values isn't necessary, as any incorrect search values will be ignored (if (isset($rewrite[$option])) will fail further down on line 943).

I've therefore removed the empty check, so that zero values can be replaced.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

LGLC’s picture

Status: Active » Needs review
FileSize
726 bytes

Patch attached.

mikeker’s picture

Status: Needs review » Fixed

Good catch on the bug. However, we need to check that $search is defined before adding it to the array. Using isset instead of empty does the trick.

Thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.