[development] Node Rendering Debate

Jeff Eaton jeff at viapositiva.net
Fri Jun 22 01:42:16 UTC 2007

It would be perfectly possible to *render* a form in that fashion,  
but unless you called drupal_get_form() it would not actually enter  
the full form lifecycle. In fact this is already possible using  
Drupal 5's infrastructure. Try this in your hook_nodeapi op view:

$node->content['my_thing'] = array(
   '#type' => 'fieldset',
   '#title' => t('Test fieldset'),
   '#collapsible' => TRUE,
   '#collapsed' => FALSE,

$node->content['my_thing']['content'] = array(
   '#value' => 'Test content goes here...',

It will add a collapsible fieldset to your view containing static  

renderable elements are renderable elements. Form elements just  
render into <input> tags and so on. FormAPI adds additional behavior  
on top of that, but under the hood, the rendering infrastructure is a  
way of taking a metadata rich array structure and rendering it into  
raw HTML (or JSON, or XML, if you feel like layering a new set of  
theme functions onto it.)

It is a tremendously powerful system. We shouldn't jump into using it  
unawares, but we would also be missing a huge opportunity to pass up  
this system of storing meta-data rich structures and renderable content.


On Jun 21, 2007, at 6:16 PM, sime wrote:

> If the drupal_render on a node is made possible, would you be able  
> insert, say, a form somewhere in the tree and have it render? Would  
> you be able to nest additional nodes in the tree? Would you be able  
> to insert parts of the node under a fapi fieldset elements? Bear in  
> mind, I'm not thinking about the ramifications on theming, more I'm  
> interested in where we see drupal_render going.

More information about the development mailing list