Anyone happen to know what functions I should call to get this working perhaps in a View's header?

Comments

R.J. Steinert’s picture

I took a large chunk out of function gigya_sharebar_nodeapi() and placed it in a block. The following code seems to work so far.

print theme('gigya_sharebar');
// Get the Link Back.
        $linkback = url($_GET['q'], array('absolute' => TRUE));

        // Get the user message.
        $user_message = variable_get('sharebar_user_message', '');
        $user_message = token_replace($user_message, 'node', $node);

        // Get the title.
        $title = variable_get('sharebar_title', '');
        $title = token_replace($title, 'node', $node);

        // TODO Get the teaser.
        $teaser = variable_get('sharebar_description', '');
        $teaser = token_replace($teaser, 'node', $node);

        // Get the action link title.
        $action_link_title = variable_get('sharebar_action_link_title', '');
        $action_link_title = token_replace($action_link_title, 'node', $node);

        // Get the action link href.
        $action_link_href = variable_get('sharebar_action_link_href', '');
        $action_link_href = token_replace($action_link_href, 'node', $node);

        //Get show counts
        $show_counts = variable_get('sharebar_showcounts', 'right');

        // Get the buttons (networks) used for Gigya Sharebar.
        $buttons = variable_get('sharebar_buttons', gigya_sharebar_button_defaults());
        $buttons = array_flip($buttons);
        unset($buttons[0]);

        $settings = array(
          'linkBack' => $linkback,
          'userMessage' => $user_message,
          'title' => $title,
          'description' => $teaser,
          'actionLinkTitle' => $action_link_title,
          'actionLinkHREF' => $action_link_href,
          'shareButtons' => implode(',', $buttons),
          'showCounts' => $show_counts,
        );

        // Allow modules to alter the object before adding the JS to the page.
        drupal_alter('gigya_sharebar', $settings, $node, $a3, $a4);

        // Facebook like is special.
        if (!is_array($settings['shareButtons'])) {
          $buttons = explode(',', $settings['shareButtons']);
          if (in_array('facebook_like', $buttons)) {
            drupal_add_js(array('gigya_sharebar' => array('facebookLikeButton' => array('action' => 'Like', 'position' => 'first'))), 'setting');
            unset($buttons['facebook_like']);
            $settings['shareButtons'] = implode(',', $buttons);
          }
        }

        // Set all the above as Drupal settings.
        drupal_add_js(array('gigya_sharebar' => $settings), 'setting');

Gigya’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Gigya's 6.x module is deprecated. We no longer support this version and we encourage upgrading to our latest module.