Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a view with no fields but a special format (An openlayer map). I would like to wrap the whole output (a map) with a static link. Typically I would like something like:

<div class="view-content">
    <a href="some static url">
        /*the map*/

Is this achievable?

EDIT My view doesn't use fields, so I can't use custom texts fields. format

share|improve this question

There might be a couple of method to do this.

Using Views: you can add a "Custom Text" global field and add view content to it and wrap it on the link or you can "Rewrite results" on the same file and output the field as a link.

Using a template file: view let you have a custom template file for your view, so you can use it to wrap your view content with the link.

Using jQuery: you can do something like this:


And that will wrap the view on a link.

See the images below to see how to add a "Custom text" field and how to make it a link:

Select custom text field

Select custom text

Add views fields into the custom text field and make it all a link

Add views fields into the custom text field

share|improve this answer
I cannot add a view to a custom text. I could add a view area to the header/footer, but not rewrite results. I also have tried to add the following snippet in the header/footer but it didn't work: <script language='Javascript'>$('div.openlayers-views-map').click(function(){document.lo‌​cation.href='/somedir';});</script> . Is that the correct way to insert it? Thank you! – NathanZ Sep 3 '12 at 14:59
I updated the answer with images. Please take a look. – redhatlab Sep 3 '12 at 20:58
Thank you Redhatlab, my view doesn't use fields and I cannot transform it in fields as it's a map... – NathanZ Sep 4 '12 at 0:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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