Is there a way to change the link text "Send to Friend" that appears in nodes to an image, similar to the Print module? Thanks!

CommentFileSizeAuthor
#2 send-themable.patch1.03 KBseanburlington

Comments

cozzi’s picture

The answer to this may also help me. I'm looking to change the format of the Link Text so that it stands out more than the rest of the links at the bottom of a blog. But, after 5 hours of searching I cannot figure out how to approach this. In full disclosure, I am not a programmer but I can find my way around given halfway decent directions AND I'm willing to document fully the procedure to make it easier for others in the future.

seanburlington’s picture

Category: support » feature
Status: Active » Needs review
StatusFileSize
new1.03 KB

Hi,
I had this same issue - I've patched my version to make the link themeable (see attached).

Patch is written against version 5.x-1.x-dev (dated 2007-Aug-01)

After applying this patch - I then added the following function to my template.php

function phptemplate_send_format_link($linktext, $modulename, $node){
       return array(
          'title' => '<img src="'.base_path().path_to_theme().'/images/email.png" alt="'.t($linktext). '" title="'.t($linktext). '" />',
          'html' => TRUE,
          'href'  => "send/{$modulename}/{$node->nid}",
          'attributes' =>  array("class" => 'send-link send-'.$modulename)
        );
}

Which replaces the text with a graphic link :-)

jerdavis’s picture

Status: Needs review » Closed (fixed)

The correct (aka, Drupal standard) way to handle this would be to create a custom module which calls hook_link_alter to modify any link on a node as you want for themeing or other reasons.

http://api.drupal.org/api/function/hook_link_alter/5