2

I have a view on a Drupal 7 site which brings in all content from 3 content types, which all have 3 different entity reference fields attached to them in order to relate them to specific areas of the site. On the view, I need to beable to filter by the 3 content types, which i have done by creating a filter on type with the 3 options. For the 3 enitity reference fields I also need to be able to filter on all the references but also have an "Any" option to enable it to show all. Due to the design of the website I need the "Any" option to have a friendly title rather than any, which I have implementing using Better Exposed Filters. For some reason the Override any feature of BEF will only override 1 field. And completely ignores the other 2.

Filters

It is working on the final filter. If i remove this filter it will work on another one, but never more than one at a time. Is there a setting I'm missing or is this a bug?

5 Answers 5

2

The issue has been fixed and patched, it hasn't been added to a release though https://www.drupal.org/node/2260691

2

I tried this kind of configuration with more then one exposed filter, yes its only overriding label for last exposed filter. May be a bug, Why not simply modify -Any- option label with hook_form_BASE_FORM_ID_alter()

function MYMODULE_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'views_exposed_form' && $form_state['view']->name == 'YOUR_VIEWS_MACHINE_NAME') {
    $form['FIRST_EXPOSED_FILTER_']['#options']['All'] = t('-NEW ANY LABEL');
    $form['SECOND_EXPOSED_FILTER_']['#options']['All'] = t('-NEW ANY LABEL');
    // and so on.        
  }
}
3
  • I used a JavaScript solution in the end.
    – Sean Lang
    Commented Aug 8, 2014 at 13:33
  • @SeanLang: Which javascript solution? Can you please post here? Commented Aug 8, 2014 at 17:33
  • Added as answer.
    – Sean Lang
    Commented Aug 12, 2014 at 8:59
1

It's a bug described here and there is a patch that resolves the issue here.

2
  • I looked at this issue and it is actually different from what I was trying to achieve.
    – Sean Lang
    Commented Aug 8, 2014 at 13:46
  • 1
    @SeanLang you need to scroll down a bit to drupal.org/node/1537074#comment-8175329 to see the followup issues but the original feature request :) Commented Aug 8, 2014 at 14:13
0

Here is the temporary JavaScript solution I applied which takes the first child of the select list and changes its HTML.

$('.form-item-field-client-target-id select option:first-child').html('Who we work with');
$('.form-item-field-services-target-id select option:first-child').html('Services');
0

More generic JS solution:

$('#SELECT-ID option[value="All"]').text('Whatever you want');

This will ensure that only the '- Any -' option will get changed and works on a case-by-case basis when you want to use a label in place of the '- Any -' text.

1
  • Hello and welcome. You referenced some other solution here. Please remember that other posts may get deleted. Make sure your answer will still make sense if this happens. Especially: be sure to include all explanations of why and how this answers the question.
    – Mołot
    Commented Aug 20, 2014 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.