It is possible to enable the Sharethis field to appear on certain content types, then hide the field on the content type display page. In hook_node_view() it would be best to check if the extra field is disabled before loading Sharethis.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

babusaheb.vikas’s picture

Hi Mstrelan,
Will you explain in detail that what you actualy want?

Thanks

mstrelan’s picture

Status: Active » Needs review
FileSize
1.97 KB

See http://www.joshwaihi.com/content/working-extra-fields-drupal-7

Specifically this part:

<?php
  foreach ($extra['node'][$node->type]['display'] as $field_name => $field_info) {
    // Check to make sure this field is visible in this view mode.
    if (empty($config['extra_fields']['display'][$field_name][$view_mode]['visible'])) {
      continue;
    }
    // ...
  }
?>

Patch attached.

purushotam.rai’s picture

purushotam.rai’s picture

Issue has been fixed while working with #2702867: ShareThis added to node content array even if the extra field is set to hidden for the display mode. So, marking this issue as fixed as of now. Feel free to re-open if the issue persists.

Thanks a lot for all your efforts. We really appreciate a lot.

purushotam.rai’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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