Jump to content

Hiding links to empty views in Drupal

Adross's Photo
Posted Mar 05 2010 04:09 PM
4240 Views

In the Drupal CMS, is there a way to make it so that views which contain no results, and which would usually display their "empty text", are simply never linked to?

Tags:
1 Subscribe


1 Reply

+ 1
  cothomps's Photo
Posted Jul 22 2010 02:11 PM

... as with anything in Drupal 'if there's a will...'

But the short answer is 'no' by default - a link to a view is often simply a path (the one you specify in the page display).

A longer answer: you might be able to use the Views API and Drupal's PHP functions (through either an input filter or a .tpl.php, depending on your need (to run the query for your view/display to determine whether or not the result is an empty set - the thing to be wary about here is how many queries you are actually running, and how complex the view/query is.

(You could also - if your view is 'static' enough - create a 'simplified' version of the views query to check for existence of the data you need, etc. Lot's of ways...)