Hello,

I know some people have asked similar questions but there seems to be no clear answer for this.

I want to remove the link altogether and replace it with an image and place that image in the body of the node. Can you provide some code that will allow me to move this link and change it to an image? 1 image for adding and 1 for removing would be ideal.

Thanks

Comments

mooffie’s picture

Category: bug » support
Status: Active » Fixed

Turning the link into an image is relatively easy: the link has distinctive CSS classes and you can style it using the CSS 'background-image' property.

Moving the link out of the links area into the body is a bit more involving. Here's one way to do it:

Open your `node.tpl.php' in an editor. A common template looks somewhat like:

.
.
.

<?php print $content; ?>

.
.
.
<?php print $links; ?>

.
.
.

And you should change it to:

.
.
.

<?php print $content;

// The link you want to pull out of the links area:
$bookmark = 'links_bookmark_1'; 

if (isset($node->links[$bookmark])) {

  // Remove this bookmark link from $node->links
  $bookmark_link = $node->links[$bookmark];
  unset($node->links[$bookmark]);
  $links = theme('links', $node->links, array('class' => 'links inline'));
  
  // ... render it ...
  $bookmark_html = theme('links', array($bookmark => $bookmark_link), array('class' => 'links inline'));

  // ... and print it right here:
  print $bookmark_html;
}

?>

.
.
.
<?php print $links; ?>

.
.
.
Anonymous’s picture

Status: Fixed » Closed (fixed)

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

chadchandler’s picture

Status: Closed (fixed) » Postponed (maintainer needs more info)

One more thing! The text on the mark/unmark link is not optional. Basically if you have an image for a bookmark..currently it makes you also have some sort of text. The text for the mark/unmark link should be optional, right?

quicksketch’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Prodigy, please open a separate request for this feature.

mooffie’s picture

Prodigy, are you asking how to get rid of the text?

Interestingly, Fivestar does "text-indent: -999em" in its CSS to push the text out of sight (but I don't know how "accessible" is that.)

(I'm re-reading my reply at the beginning of this thread, and I think the solution is way too complicated. We should make it simpler to print mark/unmark links. I've just opened a feature request.)

Anonymous’s picture

subscribed