Hello I have nodes that I want to have an image in the title but it displays html with the image path eg below

<img width="100" src=/mysite/sites/all/themes/mytheme_sub/images/flags/flag.gif> USA

I have tried a few patches that allow html into the title with no success

patch1

diff --git a/link.module b/link.module
index 4756d3d..cce3baa 100644
--- a/link.module
+++ b/link.module
@@ -930,7 +930,7 @@ function theme_link_formatter_link_default($vars) {
   }
   // If only a title, display the title.
   elseif (!empty($vars['element']['title'])) {
-    return check_plain($vars['element']['title']);
+    return check_plain(htmlspecialchars_decode($vars['element']['title']));
   }
   elseif (!empty($vars['element']['url'])) {
     return l($vars['element']['title'], $vars['element']['url'], $link_options);

and

patch2

diff --git a/link.module b/link.module
index 26697fd..685cbe6 100644
--- a/link.module
+++ b/link.module
@@ -887,7 +887,7 @@ function theme_link_formatter_link_default($vars) {
   }
   // If only a title, display the title.
   elseif (!empty($vars['element']['title'])) {
-    return check_plain($vars['element']['title']);
+    return filter_xss($vars['element']['title'], array('b', 'br', 'code', 'em', 'i', 'img', 'span', 'strong', 'sub', 'sup', 'tt', 'u'));
   }
   elseif (!empty($vars['element']['url'])) {
     return l($vars['element']['title'], $vars['element']['url'], $link_options);

Any ideas on how I can succeed ?

Comments

nevets’s picture

If I understand correctly

check_plain($vars['element']['title']);

would become

$vars['element']['title'];