I have the following in a custom module
function email_subscription_block_view($delta) { $content = ''; switch ($delta) { case 'subscribe': $content = drupal_get_form('email_subscription_form'); } $subject = NULL;
return array('subject' => $subject, 'content' => $content); }
function email_subscription_theme() { return array( 'email_subscription_form' => array( 'arguments' => array('form' => NULL), 'render element' => 'form', 'template' => 'block--email-subscription', ), ); }
function email_subscription_form($form, &$form_state) { $form['email'] = array( '#type' => 'textfield', '#size' => 15, '#maxlength' => 128, '#required' => TRUE, );
$form['submit'] = array( '#type' => 'submit', '#value' => t('sign up'), );
$form['#theme'][] = 'email_subscription_form';
return $form; }
In my template I have the following:
<div id="email-subscription"> <form id="email-subscription-form" class="email_subscription_form form"> <?php print render($form['email']);?> <?php print render($form['submit']);?> </form> </div>
With this the two elements of the form render properly. If, instead I have:
<div id="email-subscription"> <form id="email-subscription-form" class="email_subscription_form form"> <?php print render($form);?> </form> </div>
I get a wsod and the log saying memory was exhausted.