My situation is similar to the related issue. The label for exposed filter is not shown in "Advance Options" if the filter is selected to be a secondary option.

Case: I want to allow users to filter content by node IDs, thus i need the operator in the filter as well.

Thanks

CommentFileSizeAuthor
BEF exposed filter label problem.png36.69 KBnajamfzl
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

zmove’s picture

Same here

ledzepp94’s picture

This is because the secondary items don't have a render type. If you edit better_exposed_filters_exposed_form_plugin.inc you can edit the array so secondary elements are rendered as item elements:

      // Check if this is a secondary form element.
      if ($allow_secondary && $settings[$label]['more_options']['is_secondary']) {
        $identifier = $form['#info'][$filter_key]['value'];
        if (!empty($form[$identifier])) {
          // Move exposed operators with exposed filters
          if (!empty($filters[$label]->options['expose']['use_operator'])) {
            $op_id = $filters[$label]->options['expose']['operator_id'];
            $secondary[$op_id] = $form[$op_id];
            unset($form[$op_id]);
          }
          $secondary[$identifier] = $form[$identifier];
          unset($form[$identifier]);

          // Set the render element type to 'item'.
          $secondary[$identifier]['#type'] = 'item';
          $secondary[$identifier]['#title'] = $form['#info'][$filter_key]['label'];
          unset($form['#info'][$filter_key]);
         }
      }
    }
GemQueen’s picture

This throws errors if there is no label, so I made this small modification

          if ( array_key_exists('label', $form['#info'][$filter_key]) ) {
            $secondary[$identifier]['#title'] = $form['#info'][$filter_key]['label'];
          }
Neslee Canil Pinto’s picture

Status: Active » Closed (won't fix)

Hi, there will be no more future development for 7.x branch. If you see this issue in 8.x, feel free to file an issue. Closing this as Closed(wont fix).