I added the 'comments' provider option to the Share Bar. To connect with your site comments it requires the categoryID and streamID to be set on the comments Share Button object. Unfortunately, that can't be easily done since gigya_sharebar.js uses a comma-separated string instead of the Share Bar objects.

In hopes it will save some time for someone else, here is the code I added (including Step 2 and Step 3 for context):

      // Step 2: Define the Share Bar Plugin's params object.
      var params = jQuery.extend(true, {}, settings.gigyaSharebar);
      delete params.ua;
      params.userAction = ua;

      // NEW COMMENTS CODE

      // Set comments button Share Bar parameters, need to convert string of providers into ShareButton objects to work
      if (params.shareButtons.indexOf("comments") !== -1 && typeof Drupal.settings.gigyaComments !== 'undefined') {
        var shareButtonProviders = params.shareButtons.split(",");
        params.shareButtons = [];
        for (index = 0; index < shareButtonProviders.length; ++index) {
          shareButton = {provider:shareButtonProviders[index].trim()};
          if (shareButton.provider == "comments") {
            shareButton.categoryID = Drupal.settings.gigyaComments.commentsUIparams.categoryID;
            shareButton.streamID = Drupal.settings.gigyaComments.commentsUIparams.streamID;
          }
          params.shareButtons.push(shareButton);
        }
      }

      // END COMMENTS CODE

      // Step 3: Load the Share Bar Plugin.
      gigya.services.socialize.showShareBarUI(params);

I'm recording this, but also setting to Closed (works as designed) because there is the alternative option available in #2113589: Advanced settings for sharebar examples which I'd imagine is the "official" way to do it.

Comments

sokrplare’s picture

Issue summary: View changes
sokrplare’s picture

Issue summary: View changes