Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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?
Comment | File | Size | Author |
---|---|---|---|
#5 | better_formats-DRUPAL-6--1.panels_comment_support.patch | 588 bytes | dragonwize |
Comments
Comment #1
dragonwize CreditAttribution: dragonwize commentedBetter 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.
Comment #2
cursor CreditAttribution: cursor commentedYes, 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!
Comment #3
dragonwize CreditAttribution: dragonwize commentedComment #4
cursor CreditAttribution: cursor commentedPanels2 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.
Comment #5
dragonwize CreditAttribution: dragonwize commentedIn better_formats.module find the better_formats_form_alter function:
Replace:
With:
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.
Comment #6
cursor CreditAttribution: cursor commentedPerfect! 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 :)
Comment #7
dragonwize CreditAttribution: dragonwize commentedThanks. Committed. Will be in the next release.