Drupal – linking elements in a view to their content (node)

When creating a view there is an option for the title to link to the content: check box with “Link this field to the original piece of content”, but what about other elements, like an image? or a button?

For this there is a work-around:

  1. add Content: Path field as one of the fields in the view. In configure field modal box check Exclude from displayto hide this field from being displayed and rearrange fields so this field is above the fields you want to be linked to the content.
  2. click the field you want to be linked to the content to open configure field modal box and in the Rewrite results section check Rewrite the output of this field.
  3. in the opened textarea under Rewrite results write this: <a href="[path]">[field_name]</a>. you should replace field name with proper token of the field you want to be linked. you can find all the fields token in the Replacement patterns section under Rewrite results.
  4. you can repeat this for other fields in the view as long as they are below the Content: Path field.

Leave a Reply

Your email address will not be published. Required fields are marked *