When trying to enable a node panel, I got this:

Page manager module is unable to enable node/%node because some other module already has overridden with comment_bonus_api_node_page_view.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Hiroaki’s picture

same with me, unusable -.-
It broke my panels....

trevorleenc’s picture

it hasn't broken any panels, but all I am using panels for is a dashboard type page, and user profiles.

however I ran into this when trying to create a node-view panel...*ugh*

Hiroaki’s picture

yes because it overrides the view_node stuff on panel pages. it auto-disable the node related panels.

jcmarco’s picture

Title: Incompatible with panels? » Add compatibility with panels
Category: support » feature
Status: Active » Needs review
FileSize
1.1 KB

I have patched the module to add the hook_page_manager_override() that allows to change the callback function from node_view.
This way the CTools' Panels initialize all its functions and then execute the comment_bonus_api function.

Other changes are avoid the menu alter if the ctools is going to make the callback, clean the menu alter function to just the callback_function value,
and also remove the unnecessary return $items because the alter function is called by reference.

I have tested OG_Panels without problems for the OG, Panels or Ajax Comments.

kmv’s picture

The patch in #4 works for me, but only insofar as it fixes the error the OP listed. It doesn't actually improve the compatibility enough to enable you to use overridden comments (such as AJAX Comments) in a panel.

Additionally it is probably worth mentioning somewhere that in order for the basic compatibility to function you MUST enable Panels' override of Node template (/node/%node) in admin/build/pages.

kmv’s picture

I have had a look around and I think the problem is actually in CTools. The code in ".../ctools/plugins/content_types/node/node.inc" (which is the plug-in Panels uses when displaying a node) simply doesn't render comments at all - it calls node_view() directly and that's it.

I don't know CTools well enough, but I would guess that best way of fixing this might be to create a Panels widget which does its own rendering of node content.

If you are feeling hacky (as I was) then you can actually get this to work by hacking the above CTools node.inc from:

  $block->content = node_view($node, $conf['teaser'], FALSE, $conf['links']);
  return $block;

to

  $block->content = node_view($node, $conf['teaser'], FALSE, $conf['links']);

  if ($node->comment) {
    if (function_exists('comment_bonus_api_comment_render')) {
      $block->content .= comment_bonus_api_comment_render($node, 0);
    }
    elseif (function_exists('comment_render')) {
      $block->content .= comment_render($node, 0);
    }
  }

  return $block;

and your node in panels will now have comments, they even seem to AJAX properly.

Obviously I don't endorse the above approach - so I won't post a patch file. Perhaps someone should raise an issue on CTools?

mansspams’s picture

#4 did not work for me. Its a very strange patch.

Anyways. Panels allows to place node without comments and then separately comment form and comments themselves. As I understand, Comments bonus API returns node + form + comments in one peace overriding panels way of displaying node. If there could be a way for Comments bonus API to actually work with separate elements - form and comment display - then compatibility would be possible.

rjbrown99’s picture

Hi guys. I was added as a co-maintainer of the module with neochief (thanks!) If you can come to some agreement about a workable approach I'm happy to check it out. I am not using Panels so this isn't a direct issue for me but I'm more than happy to review a working patch and roll it into a commit. I'm just trying to provide some encouragement to fix it :)

vidichannel’s picture

If patch is created, I can test with latest versions of Panels and Chaos Tools. Having the same problem here.

jcmarco’s picture

The patch in #4 works for me since April

mansspams’s picture

Patch in #4 is working if node is displayed together with comments, very rare case. Panels are ment to change layouts freely, so comments form and comments display needs to be treated separately. I am working on rather large project now and it will eventually need ajax comments so I will probably be able to help, but not at the moment, since ajax comments are cosmetic thing. Also it will require little more than simple patch for few lines. Im talking colonoscopy here ;)

jthomasbailey’s picture

subscribing

EDIT: patch #4 didn't do anything for me, neither did adding those lines to ctools

tugis’s picture

The patch in #4 works for me. Thanks!

rjbrown99’s picture

There are conflicting reports back and forth about #4. Can any of you, especially those with a coding background, provide some additional insight? If this is working and helps with Panels I'd be happy to commit it, but so far I'm not feeling great about RTBC given the varying reports.

jcmarco’s picture

Panels can show different elements. If you are displaying full node then the patch in #4 works fine, but as @kmv tells, if you are displaying in a panel the different elements of a node one by one, I mean, title, body, links, comments.. then the patch #4 doesn't cover this.
For showing node elements probably it would be needed an extra work in panels code to allow overriding different elements and then add this hook to this module to override the original content when it was shown in a panel.

So, patch #4 solves one use case, when showing a full node in a panel.
The other use case, showing independent nodes elements is not solved by this patch, this would require more work in panels.

rjbrown99’s picture

#15 do you feel it is well tested enough to roll in?

jcmarco’s picture

The patch solves the specific case where you are showing a full node in a page manager/panel.
It is using a hook defined in ctools/page_manager/plugins/tasks/node_view.inc function page_manager_node_view(). So I am sure it works fine, at least in works also for me in some installations.
About removing most of the content in the menu_alter is because any of that values are default ones so it doesn't have any sense alter menu fields that have the same values.
From http://api.drupal.org/api/drupal/modules--node--node.module/function/nod...

  $items['node/%node'] = array(
    'title callback' => 'node_page_title', 
    'title arguments' => array(1), 
    'page callback' => 'node_page_view', 
    'page arguments' => array(1), 
    'access callback' => 'node_access', 
    'access arguments' => array('view', 1), 
    'type' => MENU_CALLBACK,
  );

So basically, this patch remove unnecessary code and just add a new hook function, used by ctools/page_manager.

As I told you it doesn't override when you are adding just the node's comment element of a node in a page_manager/panels. That is a different case.

jcmarco’s picture

I was testing this again, and in same time the ctools changed its behavior and now the hook override only is called when there is a page manager context. So the first conditional change that altered the menu, never is executed and it should be removed.
Once again, this patch only add the hook_pager_manager_override, that is executed only when viewing a node in panels, and not when adding just a node comment form in panels.
The change in the alter is because this is the only necessary change in the menu alter, so it is just a simplification and it doesn't affect to the other part of the hook_page_manager_override.

thomas1977’s picture

Subscribing

rjbrown99’s picture

Rather than just subscribing, can I ask that anyone who happens upon this thread applies the most recent patch and provides a bit of feedback? Thanks.

tribsel’s picture

applied latest patch. does not work with comment form and comments added to panel separately. (common case with panels i would say).

it also disabled panel overriding node view (Page manager module is unable to enable node/%node because some other module already has overridden with comment_bonus_api_node_page_view).

so i can not test the other scenario at all (full node displayed as panel content).

btw I used ctools 6.x-1.8, panels 6.x-3.9.

jcmarco’s picture

Oopss! I didn't test correctly the panels node view override behavior.
Umpteenth version of the same:

roalty’s picture

In case of panel with different elements (not node view) put this code as custom content in panels to activate ajax bonus api:

<?php
comment_bonus_api_comment_render("%node:nid");
?>
tribsel’s picture

thanks, patch 3 does not disable panels overriding nodes anymore.

roalty - when I do this, ajax comments start working. But tinymce disappears after I click reply to comment and its not possible to submit new comment - i get error message required field missing which does not say which. Maybe its because I customised my comment form.

picxelplay’s picture

Patch 3 keeps panels enabled. Then go add a comment; submits, but not ajaxed. You have to refresh page to see new comment.

smoothify’s picture

Patch 3 works well and allows me to resume using the panels node overrides once again.

I would suggest committing this now and then addressing the issue with the actual ajaxification of the comments within panels.

smoothify’s picture

I looked at the code within panels for embedding comments and noticed it uses its own comment_render function. Rather than try to force this module or Ajax comments to work with it, by far the easiest option is to create a new panels/ctools content type.

I have created a stripped out one here, which when the patch is applied allows the display of the comments & forms inside a pane with the html unaltered so ajax comments work fine.

To use it, when in the panels admin page, go to add content and choose the category Comments Bonus API on the left, then simply select 'Comments'.

There are no settings for number of comments, sorting order or anything like that - these are best controlled per node type, or could be added alongside changes to this modules comment_render override.

mansspams’s picture

what you say smoothify makes perfect sense! will try to test.

micheleqj’s picture

Tried out the patch in #28....I was able to add "Comments Bonus API->Comments" to my panel page but I'm not seeing any output from it (no comment header, no comments, no comment form) when I view a node through that panel page. Not sure what I may have missed. Comments are enabled for that node type and node and the node does have comments on it already.

Using:
Panels 6.x-3.9
CTools 6.x-1.8
Comment Bonus API 6.x-1.x-dev

Very excited about this potential solution and hoping I missed something simple.

micheleqj’s picture

Thanks for working on the patch in post #22. It doesn't seem to work for me. But that's to be expected as I'm not able to add the full node with comments to my panel page as instructed. Maybe the ability to do that has gone away in Panels 3? It seems I can only add full node content and comments separately.

smoothify’s picture

@michelqj - do the comments show when you use Comments Bonus API without panels? (i.e. on a regular node page) ?

tribsel’s picture

hi smoothify. I applied your patch #28 but I dont have any comments Bonus API on the left in panel admin page and ajax comments dont work (when I add comment form to panel and press submit, nothing happens). im using latest panels and ctools and ajax comments work on regular nodes (without panels).

Apfel007’s picture

sub

rjbrown99’s picture

Status: Needs review » Needs work

Seems like more work is needed on a patch.

calefilm’s picture

The only patch I was able to successfully patch was in #4. But it didn't do anything but allow me to enable my node/%node panel page. The non-ajax functioning remained.

I patched the others in the same place using the same methods.. I assumed I'm to patch it in the comment bonus api root folder?

Wow, but this module is disabling the node/%node entirely even when I disable commenting in all comment types using that panel page. Now I have to choose between OG or ajax comments

kevinwalsh’s picture

My solution here will be to replace Panels with context, something i was planning on doing anyway. And since the main reason i'm using Panels is for OG, there's i'll have to use Context OG module as well.

myha’s picture

The solution that works for me: create new custom content, filter format - php, code:

<?php
if(user_access('access comments')){
  $node = node_load('%node:nid');
  $_GET['comments_per_page'] = 10;
  print comment_render($node);
}
?>

I have Ajax comments 6.x-1.8, but there are some hacks for Memcache and others.