tags:

views:

1078

answers:

1
+1  A: 

theme_menu_tree would be the way to resolve this on the template.php itself. The meat of your function would be identical to your function above. Documentation is at http://api.drupal.org/api/function/theme%5Fmenu%5Ftree

But, I would recommend using CSS for what you're doing. If the text is removed entirely (via php) then you'll be depending on the user's browser to display the images and CSS properly and make navigation possible.

You might consider including both the image and the text, but making the text portion display: none so that it degrades more gracefully if CSS isn't loaded properly.

anschauung
The problem is that the source is:<li class="leaf first"><a title="" href="/testing/benecol/index.php?q=recipes"><none></a></li>So there is no way I can think of to display the <A> tag but NOT display the text within it.
hfidgen
A common trick to 'remove' the text when using background images is to move the text outside the viewport via a **text-indent:-9999px;** style in CSS.
Henrik Opel
8 years developing HTML and I never knew that.. great, thank you!
hfidgen
I'm curious why you're using background images instead or normal <img> tags. If you used <img>, you could solve the whole problem in one swoop by adding the title to the alt tags.
anschauung
@anschauung: If you write or generate the links yourself, `<img>` tags are an option, but if you're styling other peoples output or, like in this case, CMS generated stuff, this might not be possible at all or at least a lot of work. Additionally, text links are more accessible (Think search engine crawler, screen reader, etc.)
Henrik Opel
@Henrik: hfidgen is completely rewriting the link output with PHP -- note the regex in the posted code. I agree that text links are more accessible, fwiw, but I was more curious why the poster was using background images instead of <img> tags.
anschauung