I have some numeric exposed filters and the operation is "is between". Views prints out two text boxes with the label above the first one, the second with a label of "And". However, when I add it to the Secondary section, the "And" label appears, but the main label does not appear.

Looking at the view object, it seems the label for this hybrid field is in the $form['#info'] or something like that and not directly attached to the first, minimum numeric field. So it seems Better Exposed Filters would have to add some code to bring these labels for the compound exposed filters along into the Secondary area.

#12 2018173.patch818 bytesVali Hutchison
Members fund testing for the Drupal project. Drupal Association Learn more


dandaman’s picture

Here's some rather hackish code that I did to fix it:

          if (isset($form[$identifier]) && isset($form[$identifier]['min']) && isset($form[$identifier]['min']['#title']) && empty($form[$identifier]['min']['#title'])) {
            $form[$identifier]['min']['#title'] = $form['#info']["filter-$label"]['label'] . t(' Min');
            $form[$identifier]['max']['#title'] = $form['#info']["filter-$label"]['label'] . t(' Max');

I added this code to around line 1270, just before this line:

$secondary[$identifier] = $form[$identifier];

EDIT: Oh yeah, that's in better_exposed_filters/better_exposed_filters_exposed_form_plugin.inc.

coolestdude1’s picture

Issue summary: View changes

I ended up solving the issue based off of the code above, here is my code below.

Line No. 1364 of BEF 7.3-beta4 file: better_exposed_filters_exposed_form_plugin.inc

<?php if (isset($form[$identifier]) && isset($form[$identifier]['min']) && isset($form[$identifier]['min']['#title']) && empty($form[$identifier]['min']['#title'])) {
            $form[$identifier]['min']['#title'] = $form['#info']["filter-$label"]['label'];
          } ?>

Code comes before: '$secondary[$identifier] = $form[$identifier];'

When reviewing the code I did not find it necessary to affect the 'max' field because the label was already 'And'. So I can simply change my filter to say 'Post Date Between' which makes more sense. Read out completely it should be 'Post Date Between x And y'.

I do not believe the above is the proper way of dealing with the issue (hence no patch), ideally better exposed filter should detect the date picker option and allow the editing of the two entry box labels.

Niremizov’s picture

The same thing happens with date fields. To fix it - after 1374 line of code insert (better_exposed_filters_exposed_form_plugin.inc):

          $secondary[$identifier]['#title'] = $form['#info']["filter-$label"]['label']; // Line 1374
          // Fix for date fields
          $secondary[$identifier]['value']['#title'] = $form['#info']["filter-$label"]['label'];
Niremizov’s picture

And in addition to comment #3 - when date fields inside secondary options, secondary options not collapsing after applying primary options. I have fixed it with code below:

// line 613 -better_exposed_filters_exposed_form_plugin.inc
        if ($settings[$label]['more_options']['is_secondary']) {
          if ((get_class($filter) != 'date_views_filter_handler_simple' && !empty($exposed_input[$filter->options['expose']['identifier']]))
          || (get_class($filter) == 'date_views_filter_handler_simple' && !empty($exposed_input[$filter->options['expose']['identifier']]['value']['date']))) {
            $secondary_collapse = FALSE;

Niremizov’s picture

Title: Numeric between fields in secondary missing titles » Numeric between and Date fields in secondary missing titles
mikeker’s picture

Status: Active » Fixed

Issue queue cleanup... My apologies for taking so long to address this issue!

I've changed things so that in-between filters (really, any filter that has more than one child form element) show labels correctly.

  • mikeker committed 48f76df on 7.x-3.x
    Tests for #2018173.
  • mikeker committed d292f26 on 7.x-3.x
    Issue #2018173: Numeric between and Date fields in secondary missing...

Status: Fixed » Closed (fixed)

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

Jaquesante’s picture

Status: Closed (fixed) » Active

Sorry if this is the wrong status, but Date field labels are unfortunately still not showing in the secondary section.

Thanks for a great module!

tsega’s picture

This issue is still there, I'm using version 7.x.3.2.

demonde’s picture

Yes, the patch from mikeker is missing the line

$secondary[$identifier]['value']['#title'] = $form['#info'][$filter_key]['label'];


$secondary[$identifier]['#title'] = $form['#info'][$filter_key]['label'];

Vali Hutchison’s picture

818 bytes

Can confirm that #11 above fixes the missing label for date fields in the secondary section. See patch for 7.x-3.4