You are here

function sharethis_comment_view in ShareThis 7.2

Same name and namespace in other branches
  1. 8.2 sharethis.module \sharethis_comment_view()

Implements hook_comment_view().

File

./sharethis.module, line 488
A module that adds one of the ShareThis widget to your website.

Code

function sharethis_comment_view($comment, $view_mode, $langcode) {
  if (variable_get('sharethis_comments', FALSE)) {
    $data_options = sharethis_get_options_array();
    $mPath = url($_GET['q'], array(
      'absolute' => TRUE,
      'fragment' => 'comment-' . $comment->cid,
    ));
    $mTitle = decode_entities(drupal_get_title());
    $html = theme('sharethis', array(
      'data_options' => $data_options,
      'm_path' => $mPath,
      'm_title' => $mTitle,
    ));
    $comment->content['sharethis'] = array(
      '#type' => 'html_tag',
      '#value' => $html,
      '#tag' => 'div',
      '#attributes' => array(
        'class' => array(
          'sharethis-comment',
        ),
      ),
      '#weight' => intval(variable_get('sharethis_weight', 10)),
    );
  }
}