While working on an issue against the servicelink.module "different behavior between "read more" and "Add new comment"" http://drupal.org/node/79907 I ran in to this problem.

Changing how comment.mudule call node_view on line 551 from

node_view($node)

to

node_view($node, FALSE, TRUE)

seams to set the "teaser" correctly and solve the problem.

CommentFileSizeAuthor
#3 node.module_hook_link01.patch600 bytesfrjo
comment_reply_01.patch536 bytesfrjo

Comments

andyatkinson’s picture

Thanks frjo. I made the change to my 4.7.3 version and service_links now works as expected. Hopefully this patch is integrated into the core comment.module.

drumm’s picture

Status: Needs review » Needs work

This is leaving the $teaser argument as FALSE and setting $page to TRUE. $page is "Whether the node is being displayed by itself as a page." (http://api.drupal.org/api/HEAD/function/node_view), so I think this is incorrect since the node is being shown with a comment form.

frjo’s picture

Component: comment.module » node.module
StatusFileSize
new600 bytes

So it should be "node_view($node, FALSE)" instead but that doesn't work and teaser should be set to FALSE by default anyway. Time to start looking elsewhere.

I looked at node_view() in node.module and found this:

$node->links = module_invoke_all('link', 'node', $node, !$page);

The teaser is set to the opposite of page, but there are pages like e.g comment/reply where both teaser and page should be set to FALSE. I believe this is more correct:

$node->links = module_invoke_all('link', 'node', $node, $teaser);

From http://api.drupal.org/api/4.7/function/hook_link:

function hook_link($type, $node = NULL, $teaser = FALSE)

I have tested this on my own page and it makes teaser to be set to FALSE on comment reply pages for hook_link just as it is for hook_nodeapi.

To display links on a comment reply page after this change you can check for:

if (!$teaser) ...

This is how I will solve the original problem with the servicelink.module.

If this is the correct solution I would like to have it backported to 4.7.

ricabrantes’s picture

Version: x.y.z » 7.x-dev

This patch is applies?? Feature requests go to the current development
version...

saulovacerat’s picture

Thanks, you've helped me a bit with this

damien tournoud’s picture

Status: Needs work » Closed (duplicate)

Fixed after a long discussion in http://drupal.org/node/135926, so marking this one as duplicate.