1

I have a view that shows taxonomy terms with a relationship to show nodes that have a term reference to that term (relationship not required, aka LEFT JOIN).

For terms that don't have a matching node I would like to show an "add content" link.

The usual "no results" behavior doesn't seem work in this situation. What's the trick?

0

Views PHP to the rescue:

<?php
if (is_null($row->nid)){
    print '<a href=node/add/mytype?edit[field_mytype][und]='.$row->tid.'>add node for this term</a>';
}
?>

I can even pass the tid through the URL and have it prepopulated on the form (using prepopulate).

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.