Skip to content

Instantly share code, notes, and snippets.

@rpersaud
Created February 16, 2012 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rpersaud/1847060 to your computer and use it in GitHub Desktop.
Save rpersaud/1847060 to your computer and use it in GitHub Desktop.
Drupal Render Form node.tpl
<div class="content clearfix"<?php print $content_attributes; ?>>
<?php
// We hide the comments and links now so that we can render them later.
hide($content['comments']);
hide($content['links']);
drupal_render($content);
// display only for authenticated users
global $user;
if ($user->uid) {
$form = drupal_get_form('sample_form'); // generates array
print drupal_render($form); // prints out html
}
?>
</div>
@rpersaud
Copy link
Author

By calling the form in the preprocess phase, you can print out the results via print render($my_form);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment