I need to create a post/comment structure almost exactly like what you're looking at right now: original post with comments, subsequent 'answer' posts with their own comments. In response, I'm displaying a views page with a custom path displaying the original post (content type) and the subsequent answers (also content types). The issue lies with printing comment forms for each of the following nodes.
So far, I'm attempting to use the Views PHP field to print the comment form and failing pretty hard. There is D7 comment form doesn't submit relating to this, and Nikit's solution did produce a comment form on demand. However, this form does not submit or preview, submission just redirects the user to the node's comment reply page. Even now I do not understand how this method of calling
drupal_get_form() works with two arguments.
So I turned to the trusty Drupal API to reference the drupal_get_form() function and saw that it doesn't take two arguments and returns drupal_build_form() instead. I thought that calling
drupal_build_form() straight up might be more appropriate, since from what I could gleam off of the scarce user feedback said I needed to use a
form_state['redirect'] of some sort to get users back to the original node page they posted their comments from. As expected however, everything I try returns a pile of errors and gets me nowhere.
The one spot of success was with the Commentsblock module that allowed me to place a real live comment form on a page and actually have the stupid thing submit a comment. While this works for the main content, I'm still at a loss for the subsequent 'answer' comments/forms. In ripping through the source code for the module I discovered
comment_node_page_additions($node);, but this does not turn out any valid results either.
There are so many questions here:
- How does one actually USE the Forms API (and to print comments)?
- Should I be doing this in a .tpl file instead of Views?
- Where does the second argument of
- What exactly is the difference between
drupal_build_formand how are they used?
$form_state['redirect']called before either of these API calls or after?
This might seem like 'too much' of a question for a single thread, but I'm tired of posting partial questions and getting partial answers. In the interest of education, I would like to build some sort of tutorial either on Drupal.org or elsewhere so that this information can be made available to others in the same situation. Obviously I am not the best person to undertake this due to my massive lack of understanding, but maybe, just maybe with your help this can become a reality.