0

I have created content type ad with 2 fields:

  • field1 (select list)
  • field2 (select list)

created a block in views with contextual filters:

  1. field1 and "provide default argument" > php code:

    $node = node_load(arg(1)); return $node->field1['und'][0]['value'];

  2. field2 and "provide default argument" > php code:

    $node = node_load(arg(1)); return $node->field2['und'][0]['value'];

When node has all fields chosen, it works well, but if i omit 1st or 2nd field, views hiding my block. If i set "Show all values" if no default argument present, then it shows all nodes.

How can i make contextual fields optional? E.g. if first field has no value then just omit it and use 2nd contextual filter.

  • 1
    I can't really understand what you're describing. Can you show like a screenshot of your views config? – beth Mar 21 '14 at 19:00
  • I will update my question. – Alexander Kim Mar 22 '14 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.