Drupal's theme() function?
newbstah - July 14, 2008 - 22:19
Hi There -
Not talking about overriding theme functions, but the Drupal theme function listed in the API here:
http://api.drupal.org/api/function/theme/5
Is there anywhere that lists its various arguments and outputs? Examples? Are there any posts that go into depth about it? Searching for this listing has been difficult given the attention given to overriding functions in the theme. I'm seeing it a lot in modules and I'd like to figure out how to use it.

Try here
http://api.drupal.org/api/file/includes/theme.inc/5
There you'll find the various 'child functions' of the theme() function. The arguments and outputs are completely different depending on what you're trying to format. If you want to format a table, you'd need to look at http://api.drupal.org/api/function/theme_table/5, which explains in reasonable detail what the arguments are. Same goes for every different item you might want to theme: find the appropriate function and see there for more information.
theme() arguments
are listed on the API page you linked to. The first argument is a string corresponding to the theme function you want to call - the rest of the arguments are the arguments of the theme function you are calling.
eg Assuming the function isn't overriden elsewhere
theme('my_function', arg1, arg2)callstheme_my_function(arg1, arg2).You need to look at the definition of the called function to see what its arguments are. eg the definition of
theme_whatever()tells you the extra arguments to use intheme('whatever', ... ).--
Anton
New to Drupal? | Troubleshooting FAQ
Example knowledge base built with Drupal
Thanks for that info - came
Thanks for that info - came in handy just now!
---
Yuriy Babenko
www.yubastudios.com
My Drupal tutorials: http://yubastudios.com/blog/tag/tutorials
Thanks heaps!
This appears to be what I've been looking for. Thank you!
Is there any part of the documentation that uses functions in a sentence - i.e. in examples? I notice that they do it at ubercart.org and it's making it much quicker to learn. I can't seem to find a resource like that for the Drupal API and I was wondering if it exists.