I think it would be good to move the JavaScript for generating the ShareThis link into its own theme function. Something like this, I think:

function theme_sharethis_button($node_url, $node = NULL, $teaser = FALSE, $sharethis_sharethis_this_where = 0) {
  return "<script language='javascript' type='text/javascript'>
      SHARETHIS.addEntry({url: '{$node_url}', title: '{$node->title}'}, {button:true} );
    </script>";
}

That would allow a theme developer to create a custom theme function for the display of the button/link, and would also allow more control over what exactly is passed to ShareThis (e.g., additional supported properties like summary, published, etc.) as well as custom buttons using the technique described here: How do I create my own custom ShareThis button?.

Comments

strangeways’s picture

Just saw issue #248754: single-quotes in node-titles disable ShareThis and realized $node->title should be formatted with htmlentities($node->title, ENT_QUOTES).

robloach’s picture

Version: 6.x-1.2-1 » 6.x-1.x-dev

Although it makes sense to make a theme function, I'd rather have it generated through the Drupal behaviors layer if we could...

robloach’s picture

Status: Active » Fixed
robloach’s picture

Status: Fixed » Active

#347941: Behavior switched it back to a normal sharethis_add_js() function. This will have to theme the ShareThis link that's presented.

robloach’s picture

Status: Active » Fixed

function theme_sharethis($title = NULL, $url = NULL)

Status: Fixed » Closed (fixed)

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