I thought the HOOK_theme() was just for registering themes in modules. These functions are defined much differently. Could anyone help clarify this.

1) HOOK_theme() implemented in the template.php file...

/**
 * Implementation of HOOK_theme().
 */
function my_theme_theme(&$existing, $type, $theme, $path) {
  $hooks = zen_theme($existing, $type, $theme, $path);
}

2) hook_theme implemented in a module...

/**
 * Implementation of hook_theme()
 */
function node_theme() {
  return array(
    'node' => array(
      'arguments' => array('node' => NULL, 'teaser' => FALSE, 'page' => FALSE),
      'template' => 'node',
    ),
    'node_list' => array(
      'arguments' => array('items' => NULL, 'title' => NULL),
    ),
    'node_search_admin' => array(
      'arguments' => array('form' => NULL),
    ),
...

Comments

work77’s picture

bump

work77’s picture

bump

runeveryday’s picture

i want to know too,

jesse.ivy’s picture

Yeah, I'm interested as well. Trying to theme a form element here and instead they are just missing from the form. Fun! I'm going to try modifying the theme version of hook_theme and look into the theme registry more...

My guess is that they are much the same. Both just PHP functions right?

soerenP’s picture

If anyone is still interested: They are the same... (At least I´m pretty sure ;) ) Only some implementations don´t want to make use of the given arguments. Both are defined here:

http://api.drupal.org/api/drupal/developer%21hooks%21core.php/function/h...