Hi,

If I place a comment form inside the panel and better formats is enabled.. it does not work. If I remove the panel for that content type better formats works. Seems like a bug or maybe better format needs an addon?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dragonwize’s picture

Status: Active » Postponed (maintainer needs more info)

Better formats works through FAPI. How are you getting your comment form?

Are you getting it with drupal_get_form('comment_form');?

If you are not getting your form in that way then you are bypassing all the FAPI processes and no module that alters forms will work with that form.

cursor’s picture

Yes, you are right! Thanks, for that quick revert! Panels seems to be doing something else (I will check on that and probably file a issue for Panels).

For those who want to use a Better Formats enabled Comments Form with their Node-Override Panel in Panels2 (tested with 6-2.x). Here's what you can do:

1. Don't use the Panels Add Comment Form.
2. Create a New Custom PHP Content and put this into it

$block->content=drupal_get_form('comment_form', array('nid' => arg(1)), t('Post new comment'));

Enjoy!

dragonwize’s picture

Category: bug » support
Status: Postponed (maintainer needs more info) » Fixed
cursor’s picture

Category: support » bug
Status: Fixed » Postponed (maintainer needs more info)

Panels2 seems to use this to call Comment Form:

$block->content = drupal_get_form('panels_comment_form', array('nid' => $node->nid));

then in the function panels_comment_form:

function panels_comment_form(&$form_state, $edit) {
$form = comment_form($form_state, $edit);
// force the form to come back to here.
$url = parse_url($_GET['q']);
$path = $url['path'];
$form['#action'] = url($path, array('fragment' => 'new'));
$form['#redirect'] = array($path, NULL, 'new');
$form['#validate'][] = 'comment_form_validate';
$form['#submit'][] = 'comment_form_submit';
return $form;
}

I am not sure if you can over-ride that or create a hook for that in the Better Formats, or I need to file a issue with Panels team.

dragonwize’s picture

Title: Better Formats doesn't work inside a panel » Panels comment support
Category: bug » feature
Status: Postponed (maintainer needs more info) » Needs review
FileSize
588 bytes

In better_formats.module find the better_formats_form_alter function:

Replace:

  switch ($form['#id']) {
    case 'comment-form':

With:

  switch ($form['#id']) {
    case 'comment-form':
    case 'panels-comment-form':

Here is a patch if you are more comfortable with that. Let me know if that fixes it. Otherwise, will have to wait to get panels installed and setup to test with it.

cursor’s picture

Perfect! The patch works like a charm.

Thanks! I think this would be better way to do this. Maybe this could be added into the next version of Better formats :)

dragonwize’s picture

Status: Needs review » Fixed

Thanks. Committed. Will be in the next release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.