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');
  }    
} 
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

charlietoleary’s picture

I 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:

foreach ($modules as $module) {
  if (is_file(drupal_get_path('theme', 'mobile_jquery') . '/includes/modules/' . str_replace('_', '-', $module) . '.inc')) {
    include_once(drupal_get_path('theme', 'mobile_jquery') . '/includes/modules/' . str_replace('_', '-', $module) . '.inc');
  }    
} 

patch attached.

This should probably also be applied to the lines just above this snippet, which also use the dirname(__FILE__) method:

include_once(dirname(__FILE__) . '/includes/mobile_jquery.inc');
include_once(dirname(__FILE__) . '/includes/modules/theme.inc');
include_once(dirname(__FILE__) . '/includes/modules/pager.inc');
include_once(dirname(__FILE__) . '/includes/modules/form.inc');

Although they appear to be working fine so I wont tinker with them.

jeffschuler’s picture

I 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...)

charlietoleary’s picture

Status: Active » Needs review
FileSize
1008 bytes

Thanks Jeff, I have renamed the patch to suit, will know to look out for that in future.

jasonsavino’s picture

Status: Needs review » Closed (fixed)

Patch committed.