When I set a [hook]_theme function with a file field, and the file is localized in the same directory of customized module, error happened, always told report "include_once ..... error, there is no file exists in /webroot/theme/[theme package]/[aaaaa.tpl.php]"
Problem code theme.inc row: 792 -- 796:
if (!empty($info['includes'])) {
foreach ($info['includes'] as $include_file) {
include_once DRUPAL_ROOT . '/' . $include_file;
}
}
Debug code:
if (!empty($info['includes'])) {
foreach ($info['includes'] as $include_file) {
if(file_exists(DRUPAL_ROOT . '/' . $include_file)){
include_once(DRUPAL_ROOT . '/' . $include_file);
break;
}
}
}
Why:
Generally the program which was specified by file field in theme_hook is a extended library for template file. So that, it is used to localized in the module directory. because of that, the default values of $include_file should not include theme package path. But if the theme package path was included, at least the file should be checked existing.
My English is really poor, just try to understand it.
Comments
Comment #1
Anonymous (not verified) commentedThis doesn't seem to be using the theme system in the recommended way.