Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
template.php loads the .inc files that contain the theme function overrides with the loop:
$modules = module_list();
foreach ($modules as $module) {
if (is_file(drupal_get_path('theme', $theme_key) . '/includes/modules/' . str_replace('_', '-', $module) . '.inc')) {
include_once(drupal_get_path('theme', $theme_key) . '/includes/modules/' . str_replace('_', '-', $module) . '.inc');
}
}
When using the mobile_jquery as a base theme, the $theme_key global refers to the subtheme which does not contain the .inc files. I'm not sure why you are using $theme_key and not just make the loop like below, which does work with subthemes.
foreach ($modules as $module) {
if (is_file(dirname(__FILE__) . '/includes/modules/' . str_replace('_', '-', $module) . '.inc')) {
include_once(dirname(__FILE__) . '/includes/modules/' . str_replace('_', '-', $module) . '.inc');
}
}
Comment | File | Size | Author |
---|---|---|---|
#3 | mobile_jquery-fix-subtheme-module-inclusions-1354410.patch | 1008 bytes | charlietoleary |
#1 | mobile_jquery-fix-subtheme-module-inclusions-#1354410.patch | 1008 bytes | charlietoleary |
Comments
Comment #1
charlietoleary CreditAttribution: charlietoleary commentedI suggest that drupal_get_path() be used over dirname(__FILE__).
Rather than referencing the global $theme_key it should be safe to just enter the theme name as a string:
patch attached.
This should probably also be applied to the lines just above this snippet, which also use the dirname(__FILE__) method:
Although they appear to be working fine so I wont tinker with them.
Comment #2
jeffschulerI see the patch here, with the # in the filename manually encoded, but the attachment link above isn't working.
(And status should be set to needs review...)
Comment #3
charlietoleary CreditAttribution: charlietoleary commentedThanks Jeff, I have renamed the patch to suit, will know to look out for that in future.
Comment #4
jasonsavino CreditAttribution: jasonsavino commentedPatch committed.