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
Comment #1
strangeways commentedJust saw issue #248754: single-quotes in node-titles disable ShareThis and realized
$node->titleshould be formatted withhtmlentities($node->title, ENT_QUOTES).Comment #2
robloachAlthough it makes sense to make a theme function, I'd rather have it generated through the Drupal behaviors layer if we could...
Comment #3
robloachhttp://drupal.org/cvs?commit=163430
Comment #4
robloach#347941: Behavior switched it back to a normal sharethis_add_js() function. This will have to theme the ShareThis link that's presented.
Comment #5
robloachfunction theme_sharethis($title = NULL, $url = NULL)