I want my module (events) to have its own template files but extend the base theme currently enabled.
hook_theme()
:
function events_theme($existing, $type, $theme, $path) {
return array(
'test_events' => array(
'variables' => array('testingvar' => 123),
'template' => 'test_events',
'path' => drupal_get_path('module', 'events') . '/templates',
'base hook' => 'mytheme'
)
);
}
In my menu callback I have:
print theme('test_events');
This outputs the contents of the template file, but it doesn't recognize the current theme that is enabled. Is there anyway I can extend the themes layout?
Edit: current situation:
Abstract of my directory structure:
Modules\
-custom\
--events\
---templates\
----test_events.tpl.php
Themes\
-mytheme\
--templates\
---test_events.tpl.php
events.module:
function events_theme($existing, $type, $theme, $path) {
return array(
'different_event_hook' => array(
'path' => $path . '/templates',
'template' => 'test_events'
)
);
}
menu callback:
print theme('different_event_hook');
Result renders from module template file, if I change different_event_hook
to test_events
it renders from the theme template file.