0

I have two content types, one (A) refering to the other (B). I also have two languages and I want to create a view where I show a list of all content type nodes of type A with an exposed filter, filtering the refering content type nodes of type B. this will show me all nodes of A that refer to B. so my filters are

  • content type (A)
  • language (en)
  • refering node (exposed)

this works great but inside my exposed filter list of all nodes of type B every node is shown two times, representing every language translation. I now want to only show the english nodes of type B in the exposed filter list. how could I do that? thnx!

ps: I tried to use the filter groups, but this did not work.

2
  • How are you planning to select the language for the exposed filter? Commented Aug 1, 2012 at 17:13
  • I only wanted to show the english (original) ones.
    – headkit
    Commented Aug 2, 2012 at 13:18

1 Answer 1

1

The Views exposed filters block is a Drupal form, one that can be modified via a hook_form_alter or hook_form_FORM_ID_alter implementation. Here is a simple sample implementation of the more generic hook_form_alter.

/**
 * Implements hook_form_alter.
 */
function foo_helper_form_alter(&$form, &$form_state, $form_id = NULL) {
  if($form['#id'] == 'views-exposed-form-content-page') {
    // Do something with mah filters...
  }
}

If you are in doubt of what #id to use, you can always just implement this hook, go to your Views page, and watch the output of the $form variable to figure out what is the correct id to use. If you are in D7, the ID you are looking for will most likely be prepended with views-exposed....

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.