If I have a node object and would like to render just a given CCK field, how would I do so? I don't mean on a node template page or in a nodeapi hook, just in general.
My custom CCK field's theme_mymodule_formatter_default
function takes an $elements array - when this function is called on the node page, $elements is an array with keys including the following:
- #formatter
- #node
- #field_name
- #theme
- 0
- 1
...where 0 and 1 point to arrays of values in the multi-valued CCK field.
Now if I want to render this field, and all I have is my formatter function and a node object, how do I format it? If I call theme('mymodule_formatter', $node->field_my_cck_field[0])
, what gets passed to the $elements array of my formatter function is an array with only the following keys
- 0
- 1
But rather than even having to call the theme() method, I'd like to call something like drupal_render() that will pick the default theme formatter function. I imagine there's a way to do something like this, I just don't know how.