0

I'm looking to wrap the attached images (part of the content type) in an anchor. Typically we are putting together pages that are cross promotions so they go out to other non-Drupal sites

For now we are putting the images in via HTML with the a and img tags on the ones we need external links for. Now we are using views to have a grid page, block, views slideshow but these manually input images are not visually promoted in these new views.

Some had suggested having the link below the image in text (using the link module) but that solution is confusing users who see our standard 'click here to book' and 'book now' phrases on the image.

Simply how can I wrap the image with a link? (with or without the link module, which doesn't wrap)

1

You can copy the templates views uses to your theme and modify them so that a field returned in the view is used to theme another. Views has this built in in its latest versions, but only allows divs, spans, etc, and you want an anchor. Check out Exposing Individual Fields on Output for Styling here for an example of what I am talking about. There they wanted to just wrap an in a div to set the color, but you could use the same concept to wrap it in an anchor.

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.