By ntag on
Hey guys,
It is my first day playing around with Drupal so forgive me for the newbie questions but I keep coming across the term "hook" for creating functions(ex. hook_functionname()). I also came across examples showing "mytheme_functionname()".
My question is what is the difference between using hook_functionname and mytheme_functionname? Is hook just another alias for saying mytheme or are they used for different purposes?
I know these are rookie questions, but I'm only 1 day old at Drupal.
Thanks!
Comments
Hooks are implemented in
Hooks are implemented in modules and theme functions are implemented in the theme. Same idea though, you create a function with the right name and it's automatically called for you at the appropriate time.
- Brendan
Actually both modules and
Actually both modules and themes can implement both.
hooks are provided by modules as a way of interacting with their default behavior.
theme functions are evoked using theme(...) and must be declared/defined using hook_theme().