Drupal 7 Views: link content to a file path

Let’s say we have a content type with a PDF file, and we want to link the body text of the node to the file.

In the view:
FORMAT: Show: Fields

Content: PDF file
Exclude from display: Checked
Formatter: URL to file

Content: Body
Rewrite the output of this field:
<a href=”[field_pdf_file]”>[body]</a>

Hope this helps.
Using the “URL to file” formatter is the key thing to remember.
PDF file will need to appear before the Body in the fields list (so that the [field_pdf_file] token is available to the Body).

Cross-posted from http://drupal.org/node/1308078


Tagged with:
Posted in drupal

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: