0
votes

This is a very particular question so any input will be appreciated...

I'm using panels and views in a custom view template file in a drupal 7 site. The panel has a view embedded in it, as well as some extra content beneath. I have the view set with 3 contextual filters having taxonomy term pulled from url. This is working fine. So if I go to something like

/search/ford/red

It will successfully pull all items having taxonomy term "ford" that also have taxonomy term "red" applied.

But interestingly enough, if I change one of the terms to something that exists in the vocabulary, but does not happen to have any relation to items that successfully pass the first criteria, it will just load the site wrapper with the panel blank. No errors of any kind, search filter box disappears, pagination disappears, even the other content embedded in the view disappears.

It doesn't seem to matter what I choose for "Action to take if filter value does not validate" for any or all of the filters applied to the view. I tried to set it to show no results, but I assumed it didn't apply since I am also using a custom template file for the view.

I expect it to show no results. But I also expect it to have the search bar up top so the user can select a different filter from the menu, as well as the other content embedded in the view.

The search box is custom to the view template file. The only reason it would not show is if the view itself does not load. In this case it looks like the whole panel is not showing.

Feel free to ask for specifics if this is not enough to go on. Thanks.

1

1 Answers

0
votes

for future readers experiencing the many unexplained holes in drupal, here is the complete hack I had to do to prevent this unannounced error:

In my custom view I had to check the size of $view->result and then redefine it if empty:

<?php if(sizeof($view->result) < 1): $view->result = array(0 => array()); ?>
<div class="no-results">
    There are no results.
</div>
<?php else: ?>
--- normal view loop here ---
<?php endif; ?>

No, simply adding a count provision to the result loop was not working. I don't know how drupal processes the views, but if I allowed the result array to be empty it would not display the contents of this panel.

Down side - It still doesn't display any of the other content embedded in this panel, so if I had another embedded view beneath this one it would mysteriously vanish. Oh well, I'll just tell the admins they can't populate this page with anything but a filterable index. Phooey, but that's drupal life... POS.