I am using Image field and Link.

In the placeholders for Link Title, there is the Image Field token titled “Fully formatted HTML image tag”.

However, this always produces HTML text as opposed to an image with a clickable link.
Is there anyway to rectify this?

I have tried allowing Only local images are allowed. tags in the input formats, but it doesn’t seem to help.

If there is no solution to this, then is there any other module that allows users to upload an image and have it link to a site they specify?

Thanks for any help.

Comments

quicksketch’s picture

Title: Displaying a link as an image » Allow HTML in Title (using tokens)
Category: support » feature

How interesting! I never would have put the two features together in such a clever way! The HTML string as the link title is probably due to a check_plain() call on the title. Replacing this with filter_xss_admin would allow all HTML tags except for <script>, <object>, and a few others. I'll look into allowing HTML in titles when they're provided by administrators.

big_smile’s picture

The HTML string as the link title is probably due to a check_plain() call on the title. Replacing this with filter_xss_admin would allow all HTML tags except for <script>, <object>, and a few others. .

Where do I make this change? I just can't seem to figure it out (I'm not very technical!).

Any help you could give would be greatly appreciated.

bflora’s picture

I'd also like to be able to do this. I can't see a check_plain anywhere in the module code for the title info. Maybe I'm not looking for the right thing? Please advise on how to patch the module to let me do stuff like include and tags in my titles.

quicksketch’s picture

Status: Active » Fixed

There aren't any explicit calls to check_plain() in link module, but the l() function automatically runs check_plain() on all titles that are run through it. You can override this behavior by passing in the $html = TRUE flag. I've just updated the module to allow a subset of inline elements (including span, img, strong, em, and a few others) inside the link when using a static value or tokens.

D5 changes: http://cvs.drupal.org/viewcvs/drupal/contributions/modules/link/link.mod...
D6 changes: http://cvs.drupal.org/viewcvs/drupal/contributions/modules/link/link.mod...

I'm rolling out the 2.2 version shortly.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

kevinorin’s picture

I also need this function:

Mock: http://bit.ly/n6ECPw
Site: http://bit.ly/qDba3U

Brief: the mock has the title with 2 font styles. The first part in blue text and the fund/ticker in a light gray smaller font.
How would I go about accomplishing 2 styles for the title in Drupal. Is there a easy way to allow some sort of short code...
IE. [b]bold text shortcode[/b]

dqd’s picture

due to the mass of repeating feature requests regarding the additional title field, the title field teeters on the brink. Since even I - as one of the maintainers of the module - don't use the title field, I would like to provide some info here about how Drupal works and how you can reach your goal, even if this issue is for a link field version which is not supported no more, and even if the issue is closed:

  1. use the link field for its main purpose and fill the link field with a link
  2. use the text field for its main purpose and fill it with text
  3. call it link title if you want
  4. combine them both to a field group (even for multiple values) with the module field collection.

And e viola, here is your link field with a title which supports all the features, which are combinable with text fields like, tokens, html markup, translation and many more. You can even have 20 titles if you want.

dqd’s picture

tagging