Since I was unable to display my button into the node links, I have looked into the hook_node_view implementation and saw :

    if (!empty($locations[$view_mode]) && empty($locations['link'])) {
      $node->content['google_plusone'] = array(
        '#markup' => theme('google_plusone_button__' . $node->type, $button_settings),
        '#weight' => variable_get('google_plusone_weight', -10),
      );
    }
    if (!empty($locations[$view_mode]) && !empty($locations['link'])) {
      $node->content['links']['#links']['node_google_plusone_link'] = array(
       'title' => theme('google_plusone_button__' . $node->type, $button_settings),
       'html' => TRUE,
      );
    }

The correct implementation for me, since there is no "link" key in $location, is :

    if (!empty($locations[$view_mode]) && empty($locations['links'])) {
      $node->content['google_plusone'] = array(
        '#markup' => theme('google_plusone_button__' . $node->type, $button_settings),
        '#weight' => variable_get('google_plusone_weight', -10),
      );
    }
    if (!empty($locations[$view_mode]) && !empty($locations['links'])) {
      $node->content['links']['#links']['node_google_plusone_link'] = array(
       'title' => theme('google_plusone_button__' . $node->type, $button_settings),
       'html' => TRUE,
      );
    }

Am I wrong or is it a typo ?

Let me know if I can bring a patch.
Thanks!

Comments

corbacho’s picture

Title: Is there a typo in google_plusone_node_view ? » Typo in $locations links hook_node_view
Status: Active » Fixed

Hi there,
Good catch. It's a typo yes, I will fix it in the admin.inc file, when you save the settings should be 'link', not 'links'. This way both 6.x. and 7.x branches have same naming.

It's very small change, no need for patch. Thanks!

http://drupalcode.org/project/google_plusone.git/commit/60f3675

Committed to git, it will be ready to download probably tomorrow (dev branch)

Related to this, is another issue #1230158: Make it possible to display the button in the links section only in full/teaser view (You need Full/Teaser marked AND links area)

alex.druhet’s picture

Status: Fixed » Closed (fixed)

Ok great ! Thanks