1

I wonder if there is any method to obtain all available options for theme() function in Drupal installation? (I mean those one that are declared through HOOK_theme()). Or at least a resource where the most common uses are noted.

P.S. This is not trivial question for me, because almost every module introduces its own hooks for theming and if I don't know about them I can not leverage from theming opportunities. For example if I don't know about theme('table', ....) or theme('fieldset', ....) I have to write my own hooks that, e.g., another developer in his turn will not be heard of, etc.

Thank you.

3

The default theme implementations for Drupal core can be found listed here:

http://api.drupal.org/api/drupal/modules%21system%21theme.api.php/group/themeable/7

If you want the theme functions for contrib as well, you could use hook_theme_registry_alter on your install and dump out the theme registry with devel to list all the theme implementations.

e.g

/**
 * Implements hook_theme_registry_alter
 */
function mymodule_theme_registry_alter(&$registry){
  dpm($registry); // requires devel module
}
  • 1
    be prepared to welcome a massive array of at least 300 items in it :) – AyeshK Jan 29 '13 at 22:42
3

There are over 200 theme hooks in Drupal 7 core, you should not need to know all of them, since most of them will never need to be called, or overridden.

Think about the markup you would like to produce, and then either search the drupal API for a function that provides that markup, or look at a module that already produces something similar, and use the function they use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.