You are here

function sharethis_sharethis_content_type_render in ShareThis 7.2

Sharethis content type render function.

File

plugins/content_types/sharethis/sharethis.inc, line 24

Code

function sharethis_sharethis_content_type_render($subtype, $conf, $panel_args, $context) {
  if (!empty($context[0])) {
    $entity_type = is_array($context[0]->type) ? end($context[0]->type) : $context[0]->type;
    $uri = entity_uri($entity_type, $context[0]->data);
    $url = url($uri['path'], array(
      'absolute' => TRUE,
    ));
    $title = entity_label($entity_type, $context[0]->data);
  }
  elseif ($conf['path'] == 'external') {
    $url = $conf['path-external'];
    $title = variable_get('site_name', '');
  }
  else {
    $path = $conf['path'] == 'global' ? '<front>' : $_GET['q'];
    $url = url($path, array(
      'absolute' => TRUE,
    ));
    $title = $conf['path'] == 'current' ? drupal_get_title() : variable_get('site_name', '');
  }
  $block = new stdClass();
  $block->module = 'sharethis';
  $block->content = theme('sharethis', array(
    'data_options' => sharethis_get_options_array(),
    'm_path' => $url,
    'm_title' => $title,
  ));
  return $block;
}