[documentation] [Documentation bug] undocumented drupal_render behavior

alienbrain drupal-docs at drupal.org
Wed Mar 14 15:30:12 UTC 2007


Issue status update for 
http://drupal.org/node/127731
Post a follow up: 
http://drupal.org/project/comments/add/127731

 Project:      Documentation
 Version:      <none>
 Component:    Developer Guide
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  alienbrain
 Updated by:   alienbrain
 Status:       active

After lots of trial I found out that drupal_render() won't work on a
single element. Instead one should use theme('element_type', $element);


That is not confusing in some cases, but in the context of a theming
forms and using '#theme' override, one would normally use
drupal_render() to render any element they want, only to discover it
won't work unless your element has children.


Actually this might not be a matter of documentation only. I think it's
far better to correct this bad behavior. Because in some cases you might
not know if the element in hand is a single one or has children.


Also, when setting a '#theme' override on the element, drupal_render()
changes the element's '#type' to 'markup' before passing the element to
the '#theme' function so it has no way to detect the element type on
real time in order to use the appropriate theme() function.




alienbrain



More information about the documentation mailing list