sharethis_node_view() adds path support if the Pathauto module exists. It should be added if the Path module exists.

Comments

avpaderno’s picture

Version: 7.x-2.6-alpha1 » 7.x-2.x-dev
Issue summary: View changes
avpaderno’s picture

Issue summary: View changes
Status: Active » Fixed

The code for that function has been changed in the 7.x-2.x branch. It doesn't check anymore if a module is installed.

function sharethis_node_view($node, $view_mode, $langcode) {
  // Don't display if the user is currently searching, or in the RSS feed.
  switch ($view_mode) {
    case 'search_result':
    case 'search_index':
    case 'rss':
      return;
  }
  // First get all of the options for the sharethis widget from the database:
  $data_options = sharethis_get_options_array();

  // Get the full path to insert into the Share Buttons.
  $mPath = url('node/' . $node->nid, array('absolute' => TRUE));
  $mTitle = $node->title;

  // Check where we want to display the ShareThis widget.
  $location = variable_get('sharethis_location', array('content' => 'content'));
  if (in_array('content', $location, TRUE)) {
    $enabled_types = $data_options['sharethis_node_types'];
    if (isset($enabled_types[$node->type]) && $enabled_types[$node->type] === $node->type) {
      $display_settings = field_extra_fields_get_display('node', $node->type, $view_mode);
      if (isset($display_settings['sharethis']) && $display_settings['sharethis']['visible']) {
        $node->content['sharethis'] = array(
          // Wrap it in a div.
          '#tag' => 'div',
          '#type' => 'html_tag',
          '#attributes' => array('class' => 'sharethis-buttons'),
          '#value' => theme('sharethis', array(
            'data_options' => $data_options,
            'm_path' => $mPath,
            'm_title' => $mTitle,
          )),
          '#weight' => intval(variable_get('sharethis_weight', 10)),
        );
        // Include necessary js files.
        sharethis_include_js();
      }
    }
  }

  if (in_array('links', $location, TRUE)) {
    $enabled_view_modes = variable_get('sharethis_' . $node->type . '_options', array());
    if (isset($enabled_view_modes[$view_mode]) && $enabled_view_modes[$view_mode]) {
      $links['sharethis'] = array(
        'html' => TRUE,
        'title' => theme(
          'sharethis',
          array(
            'data_options' => $data_options,
            'm_path' => $mPath,
            'm_title' => $mTitle,
          )
        ),
        '#attributes' => array(
          'class' => array('sharethis-buttons'),
        ),
      );
      $node->content['links']['sharethis'] = array(
        '#theme' => 'links',
        '#links' => $links,
        '#attributes' => array(
          'class' => array('links', 'inline'),
        ),
        // Wrap it in a div.
        '#tag' => 'div',
        '#type' => 'html_tag',
        '#weight' => intval(variable_get('sharethis_weight', 10)),
      );
      // Include necessary js files.
      sharethis_include_js();
    }
  }
}

Status: Fixed » Closed (fixed)

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