Drupal 6 - Including a module form in a view

Posted by espais on Stack Overflow See other posts from Stack Overflow or by espais
Published on 2010-05-25T07:53:50Z Indexed on 2010/05/25 8:01 UTC
Read the original article Hit count: 347

I'm making use of the Favorites module, in order to allow my users to favorite nodes they like.

Currently, I know that there is a block available for listing out the favorites, along with the 'Add to favorites' button at the top of this list.

What I'd like to do is generate the form which includes the button, and include it within each node that I generate. I'd gotten it hacked up and quickly working by copying the generated form and placing it in my views-view--fields-.tpl.php template, however I believe that doing it this way goes against the thought behind Drupal, and probably introduces security issues with the form_id and form_token being hand-written.

I've attempted to call the get_form function, and have passed it the form_id that I found in the generated form code, however I can't get Drupal to recognize it. From some Googling I've noticed that generating module forms programmatically may require a hook, but I haven't been able to find any good examples of this.

What is the best way to go about creating this form?

© Stack Overflow or respective owner

Related posts about drupal

Related posts about drupal-6