A form theming example would be a nice addition to the form_example if you'd be interested in posting a patch.<br><br>Thanks,<br><br>-Randy<br><br><div class="gmail_quote">On Sun, Oct 24, 2010 at 10:45 AM, Bob Hutchinson <span dir="ltr"><<a href="mailto:hutchlists@midwales.com">hutchlists@midwales.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">On Saturday 23 October 2010, Earl Miles wrote:<br>
> On 10/22/2010 1:56 PM, Bob Hutchinson wrote:<br>
> > In D7 I get somewhat different behaviour:<br>
> ><br>
> > If I do not create an entry in the theme registry, all works as expected,<br>
> > but if I do, things start to behave oddly.<br>
> ><br>
> > function mymodule_theme() {<br>
> > ....<br>
> ><br>
> > 'mymodule_thingy_form' => array(<br>
> ><br>
> > 'variables' => array(<br>
> ><br>
> > 'form' => NULL,<br>
> ><br>
> > ),<br>
> ><br>
> > ),<br>
><br>
> In D7 the above should actually be:<br>
><br>
> 'mymodule_thingy_form' => array(<br>
> 'render element' => 'form',<br>
><br>
> > ....<br>
> > }<br>
> > and create a function<br>
> > function theme_mymodule_thingy_form($variables) {<br>
> ><br>
> > $form = $variables['form'];<br>
> > $output = drupal_render($form);<br>
> > return $output;<br>
> ><br>
> > }<br>
><br>
> You should use either render() or drupal_render_children() rather than<br>
> drupal_render(). So far as I could figure out, drupal_render() should no<br>
> longer be used inside theme functions. You use render() to render a<br>
> specific element, and drupal_render_children() to render all the<br>
> children but NOT the element (which is what you want when attempting to<br>
> render $form since that is currently being rendered).<br>
<br>
I ran some trials using form_example from <a href="http://drupal.org/project/examples" target="_blank">http://drupal.org/project/examples</a><br>
I found that indeed I should not use drupal_render() inside theme functions,<br>
drupal_render_children() works fine.<br>
I also found that using drupal_get_form() within a function (as opposed to in<br>
a menu) requires the output of drupal_get_form() to be run through render(),<br>
otherwise the form is not complete. The theme (defined with 'render element')<br>
is picked up automatically, the same as it is when calling drupal_get_form()<br>
directly in a menu $item.<br>
<br>
Thanks for your help.<br>
<font color="#888888"><br>
--<br>
-----------------<br>
Bob Hutchinson<br>
Midwales dot com<br>
-----------------<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Randy Fay<br>Drupal Module and Site Development<br><a href="mailto:randy@randyfay.com">randy@randyfay.com</a><br>+1 970.462.7450<br><br>