Closed (duplicate)
Project:
Drupal core
Version:
7.x-dev
Component:
documentation
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
15 Jul 2009 at 07:43 UTC
Updated:
5 Mar 2010 at 05:18 UTC
I just spent a lot of time struggling with hook_theme with following syntax:
function taxonomy_sites_theme($existing, $type, $theme, $path) {
return array(
'taxonomy_sites_frontpage' => array(
'arguments' => array('taxonomy' => NULL, 'term' => NULL),
'template' => 'master',
'type' => 'theme',
),
);
}
Note that template file is supposed to be master.tpl.php and theme is called taxonomy_sites_frontpage. That is incorrect. Due to the fact how theme system discovery works, Drupal will never find your master.tpl.php file in your themes.
Why? Because 'taxonomy_sites_frontpage' != 'master'. They need to be equal in order to have this functionality.
There are two options:
1) It's a bug. - I am not sure about that
2) It needs to be stressed in hook_theme() documentation so people know exactly what's going on.
I am leaning towards 2
Comments
Comment #1
effulgentsia commentedI agree that this is an unfortunate WTF of the theme registry's auto-discovery code, but one I don't recommend fixing this late in D7 development (we've lived with it this long). If anyone feels inspired to come up with some good text in hook_theme() documentation for it, that would be awesome!
Comment #2
effulgentsia commentedThis is a duplicate of #342350: Override template files based on template filename as well as hook name