2

I am using a module (donate) that produces a form at a specific URL, for example, http://example.com/donate. I would like to put this form inside a block and display it on another page. Do you guys know the best way to do this? Thanks for reading.

1
  • For which version of Drupal are you interested?
    – apaderno
    Mar 25, 2011 at 21:52

3 Answers 3

2

If you switch to 'donation' module and 'simple_paypal' You can create a block with the content:

<?php
require_once(drupal_get_path('module', 'donation') .'/donation.module');
print donation_form();
?>

Make sure to set input format to PHP code

1
  • How would one do this with an existing node and you wanted to embed the add function. Say in Organic Groups embed the post form on the group page?
    – user12342
    Nov 26, 2013 at 14:48
1
<?php
print drupal_get_form('my_form'); //my_form is the function that returns the $form array
?>

Just put the above code in the block to display the respective form in a block. Any callback that returns HTML will work instead of drupal_get_form().

0

I don't know if it will work in your case but you can test Blockify module.

1
  • Solved. I used print drupal_get_form('form_id') to print the form in my page.tpl.php file
    – berto77
    Mar 25, 2011 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.