While testing #2422123: should entity view hooks be triggered unconditionally in node_view, term_view and user_view pages? we came across an interesting problem in Open Atrium. In the latest OA version we have the ability to embed full nodes as "related content" within other nodes. This includes any comments made to the embedded node. We found that when the comments on the embedded node exceed the comments per page, the pager is not actually shown. It is shown on the node with the comments, but not the node that has the embedded node with comments (hope that makes sense).
Basically, what I found is that the Drupal pager system is using the $pager_page_array global variable to keep track of pagers on the page. In the case where there are multiple pagers on the page the comment panes in ctools fail because they don't set the $element of the pager, always assuming it is zero (the first pager).
The pager_default_initialize() function that sets up the global array is called from the query set up in comment_get_thread() in the comment module. But it doesn't have any way to pass back which $element index was just created. So in the ctools panes we just use the max(array_key) of the global $pager_page_array.
Patch coming.
Comment | File | Size | Author |
---|---|---|---|
#1 | ctools-more_than_one_comment_pager-2483415-1.patch | 1.42 KB | mpotter |
Comments
Comment #1
mpotter CreditAttribution: mpotter commentedComment #2
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedconflicts with https://www.drupal.org/node/2433923#comment-10070732
Comment #3
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 5 May 2015 patch to node_comment_wrapper.inc and node_comments.inc applied cleanly to the latest ctools 7.x-1.x-dev and if still applicable needs to be reviewed.
Note, the previous comment states: