Closed (fixed)
Project:
Google Plus One Button | Google+ Badge
Version:
7.x-1.2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
28 Nov 2011 at 16:17 UTC
Updated:
29 Nov 2011 at 10:03 UTC
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
Comment #1
corbacho commentedHi 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)
Comment #2
alex.druhetOk great ! Thanks