Posted by tomamon on January 8, 2013 at 12:19am
I am trying to figure out how to display a link field as an image. What I am specifically trying to do is have users enter in their ReverbNation page url for the link but, display the ReverNation icon instead of text. Is this something I should finagle with css or wrap the field within a span and set display to hidden? Any help is greatly appreciated.
Cheers
Comments
My 2 cents
I think you should theme your field and put the image right in the markup instead of messing with the CSS:
http://api.drupal.org/api/drupal/modules!field!theme!field.tpl.php/7
That will make the markup cleaner and easier to understand.
=-=
can investigate http://drupal.org/project/linked_field
linked_field
Thanks I've installed that. I must be missing connecting the dots here. What I've done is create a field as type "Link" wherein users put their facebook url. What I want to display is not text for the URL on the content page but, an image ie the facebook icon... I'm trying the above mentioned method of field template but, it's new territory for me so it's taking a bit. Just seeing if there is other options.
Thanks again for the repsonse
Thanks guys
I wound up theming the field.
What I specifically did was create a field type "link" and have the format display as "URL, as plain text". Then wrapped the output of the field in
<a>and used<img>as the hyperlink output.Here is what I have in my field--field_yourfieldname--yourcontenttype.tpl.php
<a href="<?php print render($item); ?>" target="_new"><img src="../sites/default/files/link-icons/levelten/glossy/32x32/facebook.png" /></a></div>Hope this helps anyone else.