Closed (fixed)
Project:
ShareThis
Version:
7.x-2.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
26 Jul 2013 at 03:13 UTC
Updated:
15 Feb 2017 at 20:01 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
xenophyle commentedHere is a patch that will allow choosing multiple options for Location.
I wasn't sure how to best do this in the code, so you will need to delete the sharethis_location value in the {variable} table manually before the patch will work.
Comment #2
mcfilms commentedThank you xenophyle. I'll try and review this, although I came up with a work-around for the site in question. In any case, this will be a great feature and I think other module users will appreciate it in the future.
Comment #3
socialnicheguru commentedno longer applies to latest module 2.6
Comment #4
ubermichael commentedHere's a patch against 7.x-2.10 that applies cleanly. It requires that someone delete the
sharethis_locationvariable before it works.Comment #5
ubermichael commentedThe previous patch was dumb and should be withdrawn. This one fixes a few more things, like checking for array keys and their values. It also makes the Share This stuff show up on the Manage Display screens.
Comment #6
daddison commentedHey ubermichael, the second version of your patch has some formatting issues (at least the one I just downloaded did). I cleaned it up and applied it to version 7.x-2.12 and it works. I didn't even need to delete the variable. Thanks!
Comment #8
ryan.ryan commentedThanks for the patch, I've rerolled it to work with 7.x-2.12.
To the maintainers, is there a reason this can't be merged? It's gotta be a pretty common need to have share links on content but also in blocks.
Comment #9
ShareThis Support commentedHi There,
Thanks for your patience here! We've made some changes in our support organization and we're working through responding to these. We've added this as a feature request for our team to review!
Best
ShareThis Support
Comment #10
mikemccaffreyHmmm... from what I can tell, the most recent patch doesn't work, and I'm not sure how it would work as submitted. Even though the sharethis_location variable is being turned from a string into an array at the start of the config form function, the corresponding field has been left as radio buttons where only one of the three choices can be selected. And due to the mismatch, it doesn't seem like any can be successfully selected after the patch is applied.
However, that issue is a bit moot, since it seems like the settings of where the widget is displayed can be almost completely removed, and the module can simply provide both a block and a field display for every content type by default. And then if the site builder wants to show the widget on a page, they can either place the block into a region or enable the field in a display mode, or they can just leave them as disabled if they are not wanted.
It seems like the only useful location setting on this form is the choice of which content types and view modes you'd like to display the widget inside of the node links, but even this would arguably be better situated on the individual entity type configuration forms.
Make sense?
Comment #11
mikemccaffreyWell, I found a good reason not to just provide ShareThis as an extra field in the display settings for every node type: by default every extra field you define starts off as visible on every display mode of every content type. So we should keep the option for which content types to provide the extra field for, unless we want to write an update function that turns off the extra field by default on all existing content types: http://drupal.stackexchange.com/questions/6404/hook-field-extra-fields-h...
However, there still doesn't seem any reason not to provide a block, even if one of the content display choices is enabled. Attached is a patch that removes the check on whether or not to provide the block, and also rephrases the choice on the settings form to "Block only", so it is at least a bit clear that block is still provided if you select one of the other options.
Comment #13
sandip27 commentedHi, The patch provided by ryanissamson was a bit outdated hence, please find the updated patch for Implementing ShareThis For Block as well as Node at same time.
Thanks
Comment #14
sandip27 commentedTo the maintainers, would be really glad if you could review and merge patch @ #13 and make it available as its very common need.
Comment #15
harivenuvHi,
Thank you for the patch and it's working fine. I have cleared the coding standard issues and attaching the patch here.
Comment #16
sandip27 commented@harivenu_zyxware, Thanks for the review. Well, when I created a patch, I didn't expected to check for the existing coding standard errors which I think now, I have to. Anyways, thanks again for the review.
I have tried applying revised patch was getting error as "fatal: patch fragment without header at line 196: @@ -280,8 +285,8 @@ function sharethis_get_options_array() {" hence I have created a new patch with you suggestions as well in it.
@gaofengzzz, Please merge the patch sharethis-ShareThis_in_block_AND_on_node-2050875-16-7.x-2.x.patch so that we would be able to see the feature in action !
Thanks
Comment #17
sandip27 commented@gaofengzzz, any word on merging the patch ?
Comment #18
naveenvalechaThanks for the patch. It needs reroll as will not apply after the changes to the code.
Comment #19
sandip27 commented@naveenvalecha, Please find attached the re-rolled patch. I have checked on my local setup and cleanly applied this patch, so seems we are good to go.
Thanks and let me know if any further issues.
Comment #20
sandip27 commentedComment #21
naveenvalechaPatch does not apply anymore.
Checking patch sharethis.admin.inc...
error: while searching for:
$form['context']['sharethis_location'] = array(
'#title' => t('Location'),
'#type' => 'radios',
'#options' => array(
'content' => t('Node content'),
'block' => t('Block'),
error: patch failed: sharethis.admin.inc:175
error: sharethis.admin.inc: patch does not apply
Checking patch sharethis.module...
Hunk #1 succeeded at 104 (offset -2 lines).
Hunk #2 succeeded at 164 (offset -2 lines).
Hunk #3 succeeded at 471 (offset -2 lines).
Comment #22
naveenvalechaComment #23
sandip27 commentedHello @naveenvalecha, you sure you are applying the patch to branch 7.x-2.x ? Cause that's what I am doing, since branch 7.x-2.x is the current branch and its applying cleanly. I also tried applying it on couple of more branches on different PC's and working fine on every one of them.
Please check or let me know if what I need to do further to cure it.
Thanks and appreciate your response.
Comment #24
naveenvalechayes. have you done the git pull before applying the patch ?
you can reproduce this by following these steps :
git apply -v https://www.drupal.org/files/issues/sharethis-ShareThis_in_a_block_AND_on_nodes-2050875-19-7.x-2.x.patchComment #25
sandip27 commentedCheck the attached revised patch.
Thanks
Comment #26
sandip27 commentedComment #27
sandip27 commentedHello @naveenvalecha, any word about this patch review ? Just wondering if we are good to go with this patch or how ?
Thanks
Comment #28
naveenvalechaAssigning to purushotam to do the needful
Comment #29
Pallavi Gupta commentedHow to display Sharethis buttons for a content type for which a custom tpl file is made? Even if in Manage Display tab Sharethis is set to be visible mode, then too I think my custom tpl file is overwriting it and hence I am not getting share this icons on my content page.
Comment #30
sandip27 commentedHello @purushotam.rai,
It's been 4 months, any updates on merging this patch ?
Thanks
Comment #31
yogeshmpawarComment #32
yogeshmpawarI have added few changes using last patch by @sandip27, now this patch working for me.
Comment #33
navneet0693 commentedThis throws an undefined index error. As it $location[0] = 'content'; (Refer to screenshot) This observation is only made on first install of module. After first install $location will have only 1 index. After you goto configurations and click Save Configurations without any changes, $location will have 3 indexes.
Comment #34
yogeshmpawar@navneet0693 - made changes as per your comment #33.
Please review the updated patch with interdiff.
Comment #35
navneet0693 commentedCheck is necessary, as $location['content'] will be present but its value may be blank, or not set to 'content'. We will have to figure another way to it.
Comment #36
yogeshmpawar@navneet0693 - made changes as per your comment #35.
Please review the updated patch with interdiff.
Comment #37
navneet0693 commentedThe default value should be array of content => content. Also, the default #state behaviour isn't working for any options.
Comment #38
yogeshmpawar@navneet0693 - changes done as per your comment #37. changing status to Needs Review again.
Comment #39
navneet0693 commentedWorking as per expectations.
Comment #40
gg24 commentedI have re-tested the patch. It works fine for me.
Comment #41
purushotam.rai commentedComment #42
naveenvalechaWhy Patch (to be ported) ?
Comment #43
purushotam.rai commentedComment #45
purushotam.rai commentedPatch #38 is working fine. Thanks for all your efforts. Pushing code to 7.x-2.x branch
Comment #47
vinmassaro commentedComment #48
danjr98 commentedHi
I have installed Drupal 8 with the ShareThis.
The ShareThis is being added to CONTENT block
I was expecting that it would share the "content" of the page or article but rather it is sharing the whole page (node i guess)
I have read the above but not sure what i have done wrong.
I really like this widget.
Thanks for any feedback
Comment #49
Chris CharltonFYI, just pointed out a small issue with sites also running Domain Access. Solution provided here: https://www.drupal.org/node/2846151#comment-11937569