Closed (fixed)
Project:
Link
Version:
6.x-2.5
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
7 Oct 2008 at 21:24 UTC
Updated:
23 Jan 2010 at 21:57 UTC
Hi,
I'm interesting to use link to create an image link where only the link can be changes and the images is set. I though doing it thru the themplate file, like this:
![]()
Instead on thr a href printing the field. My question is: is there a way to print the field and insert the image in it?
Thanks in advance
Comments
Comment #1
Sooki commentedWhen I wrote like this, I meant this:
Comment #2
quicksketchI'd suggest you create a custom module that implements hook_field_formatter_info() and creates a new formatter for your site that is "link with image". If that sounds too daunting, then you could simply override the default formatter. Open link.module, copy the "theme_link_formatter_default" function, paste it into your template.php, rename the function to "[name of your theme]_link_formatter_default", then change as necessary to put whatever image you like in there.
Comment #3
Sooki commentedThe solution turned out to be so simple, after viewing the way the module output the link, I was like "Hey, what if I just put the html code in the title field?" and it worked!
Comment #4
samirnassar commentedDoesn't this leave link open to malicious entering of markup if any random markup can be put in the title field?
Comment #5
quicksketchNo, link.module uses a strict list of acceptable inline elements that are allowed in link titles. Also, note that HTML is only allowed if you're using a predefined title for all links (so it's setup by the administrator) or if you allow tokens to used by your end-users. Either way, it's still run through filter_xss() and doesn't allow scripts or css. See #214194: Allow HTML in Title (using tokens).
Comment #6
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #7
sittard commentedWhat would be required to get the output like this:
Comment #8
Ela commented#3, Sooki, Thank you for that great tip!! :D