I'm sorry if this was mentioned before but I couldn't find it. How do you set the contextual filter to be empty if it's not given? I.e. I have a bunch of nodes that are structured with "parents" via node references. To allow the user to find the content in the admin I created a view that I want to list all the nodes with no parents if there is no argument given and then if an argument is given list the nodes with the parent in the argument. On the normal filter list I can add the node reference field and say "is empty". But on the contextual filter I can add the node reference but I can only have it show all if no argument is given. I tried 0, null and a blank array via the php options and got nothing. Is there any way I can do this?

CommentFileSizeAuthor
#1 default_display_empty.png33.39 KBbabusaheb.vikas
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

babusaheb.vikas’s picture

FileSize
33.39 KB

This problem is related to your contextual filter configuration.

To set the contextual filter result to be empty if it's not given follow the simple steps:---

  • Select an option 'Provide default value' next to When the filter value is NOT in the URL in your contextual filter.
  • Select Fixed value next to Type
  • Put 0 in Fixed value textbox.

Also, take a look on attached screenshot for reference.

I hope your problem will fix.

Daemon_Byte’s picture

I can't remember exactly what I did to fix it but I did find a way. I will remember this for next time. Thanks for the help

Daemon_Byte’s picture

Status: Active » Closed (fixed)