Add  link around each row in views So basically i want to add a link to original node around each row in views. I have added the following code to the style and row template override in views. Both come up with the same result.

&lt;?php $image = file_create_url($row-&gt;field_field_display_image[0]['rendered']['#item']['uri']); ?&gt;
&lt;a href="www.google.com"/&gt;
  &lt;div class="block__inner" style="background-image: url('&lt;?php echo $image; ?&gt;');"&gt;
    &lt;?php foreach ($fields as $id =&gt; $field): ?&gt;
      &lt;?php if (!empty($field-&gt;separator)): ?&gt;
      &lt;?php print $field-&gt;separator; ?&gt;
    &lt;?php endif; ?&gt;
  &lt;/div&gt;
&lt;/a&gt;


Now the issue that i am having is that the link is added to each field element that is outputted for some reason, and not just the link around the whole row and each field.

I cannot use custom field as that is making the same issue. It seems views is auto closing the a tag.

Any known workarounds?
I usually remove all default formatting from every field, then hide all of my fields from display apart from the last field in views, and also remove all formatting, making the hidden fields plain text where possible.

Then in that last fields settings, rewrite the results, and input all of the fields as tokens from the replacement patterns.

Then instead of div elements, I use span which plays better inside an anchor, and just add unique classes for each span element.

So an example rewrite results might be...

&lt;a href="[path]"&gt;
&lt;span class="title"&gt;[title]&lt;/span&gt;
&lt;span class="body"&gt;[body]&lt;/span&gt;
&lt;/a&gt;


This should not suffer the same issue if you go to each hidden field, and under the style fieldset, make sure than no default wrapper or classes are applied, and also that each field is plain text. This will strip all formatting and place it inside the rewritten span elements. Like @BeeBee says, div and p will break the anchor wrapper.