Would it be possible to use hook_block to enable users to choose which region the ShareThis link is displayed?

CommentFileSizeAuthor
#3 block.patch1.04 KBrobloach

Comments

mrgoltra’s picture

subscribing

robloach’s picture

Version: 6.x-1.4 » 6.x-1.x-dev
/**
 * Implementation of hook_block().
 */
function sharethis_block($op = 'list', $delta = 0, $edit = array()) {
  switch ($op) {
    case 'list':
      $blocks['sharethis'] = array(
        'info' => t('ShareThis'),
      );
      return $blocks;
    break;
    case 'view':
      if ($delta == 'sharethis') {
        sharethis_add_js();
        return array(
          'subject' => t('ShareThis'),
          'content' => theme('sharethis', drupal_get_title(), $_GET['q']),
        );
      }
    break;
  }
}

Unfortunately blocks can't have specific JavaScript......

robloach’s picture

Status: Active » Needs review
StatusFileSize
new1.04 KB
robloach’s picture

Status: Needs review » Fixed

Committed.

psynaptic’s picture

Thanks Rob!

Status: Fixed » Closed (fixed)

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