I'm trying to create a module that will override the core blog functionality. (I didn't want to break the "Don't hack the core!" rule and change the blog code directly.)
Anyway, I'm trying to theme the output using theme functions within my module. I'm trying to use core modules as an example to follow, but it's leaving me more confused. For instance, I'm starting out by modeling my module after the node module. What is confusing me lots is that node_theme registers a 'node' hook, which my limited API knowledge leads me to believe that corresponds to a 'theme_node' function. And I'm sure you already know that, but theme_node doesn't exist anywhere! So I guess question 1 is: How does this work? I noticed that the Chameleon theme has a .theme file that has chameleon_theme, but none of the other core themes have this type of file or function (I think).
At this point, I'm just trying to replicate other modules that have theme hooks like this (node, forum, book, etc.) without an explicit theme_ function. So, assuming my module is 'foo', I have this code (basically trying to replicate node functions):
function foo_theme() {
return array(
'foo_blog' => array(
'arguments' => array('node' => NULL, 'teaser' => FALSE, 'page' => FALSE),
'template' => 'foo_blog',
)
);
}
function foo_blog_view($node, $teaser = FALSE, $page = FALSE) {
return theme('foo_blog', $teaser, $page);
}
My 'foo_blog.tpl.php' file is a direct copy of node.tpl.php and lives in my module folder. I also have a preprocessor function that appears to be working (using debug messages), but I'm not getting any output. Do I need to re-set my template variables in the preprocessor? Do I need to define a 'theme_foo_blog' function?
Any help or points of reference are appreciated.