Theme function files do not seem to be getting loaded for theme hook suggestions. E.G. field--field-name.theme.inc.
OmegaThemeRegistryHandler::registerThemeFunctions() is properly detecting the file and adding it to the registry under the suggestions own array. However it seems the includes will never be called because Drupal's theme() function only includes files for the base theme.

I don't have time to make a proper patch at the moment but the fix is a simple one in OmegaThemeRegistryHandler::registerThemeFunctions() change:

      // By adding this file to the 'includes' array we make sure that it is
      // available when the hook is executed.
      $this->registry[$item->hook]['includes'][] = $item->uri;

to

      // By adding this file to the 'includes' array we make sure that it is
      // available when the hook is executed.
      $this->registry[$base]['includes'][] = $item->uri;

Seems odd that this has gone unnoticed and I wondered why I never ran into this before but I realised whenever I have used non-base theme functions they have tended to be small and thus I lazily put them in my template.php file. Others may be as slack as me :P

Comments

drupal_was_my_past’s picture

Closed #2307897: Theme function override not working as a duplicate of this issue.

drupal_was_my_past’s picture

Status: Active » Needs review
StatusFileSize
new486 bytes

Good catch @magicmyth. I spent a really long time puzzling over this and when I finally figured it out, I discovered you had already beat me to it. Here is a patch.

  • fubhy committed bd6ecce on 7.x-4.x
    Issue #2292961 by rocket_nova | magicmyth: Fixed Function include files...
fubhy’s picture

Status: Needs review » Fixed

Thanks! Fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

sylus’s picture

Status: Closed (fixed) » Needs work

Please close if improper to reopen this issue but this recent commit caused menu that I was invoking to not appear when logged out but strangely work when logged in.

Reverting this commit caused my menus to function properly again when logged out.

I invoked one of my menus by the following:

  $menu = ($is_multilingual) ? i18n_menu_navigation_links('menu-wet-terms') : menu_navigation_links('menu-wet-terms');
  $terms_bar_markup = theme('links__menu_menu_wet_terms', array(
    'links' => $menu,
    'attributes' => array(
      'class' => array('links', 'clearfix'),
    ),
    'heading' => array(),
  ));
  $variables['menu_terms_bar'] = $terms_bar_markup;

Is there something I am missing?

sylus’s picture

I put a dpm before this commit above:

dpm($item->hook);

....
links
links
links
pager_first
pager_last
pager_next
pager_previous
pager
panels_ipe_placeholder_pane

dpm($item->hook);

links__menu_menu_wet_footer
links__menu_menu_wet_header
links__menu_menu_wet_terms
pager_first
pager_last
pager_next
pager_previous
pager
panels_ipe_placeholder_pane

So using $base we don't get the full form for links?

sylus’s picture

StatusFileSize
new486 bytes

Attaching patch to revert this commit so I can patch on latest stable 4.3

joelpittet’s picture

Status: Needs work » Needs review
nightlife2008’s picture

Hey guys,

I was experiencing the exact same issue, with the following steps to reproduce:

1. Go to your subtheme settings page in Drupal admin.
2. Change nothing, just press "Save".
3. Frontend is broken, showing empty divs, missing preprocessors etc.
4. Flush theme registry cache
5. Frontend is fixed, showing proper classed divs, running necessary preprocessors etc.

I was able to fix the issue, by currently disabling the Mailsystem module, so I presume the bug occurs in that module rather than the Omega registry.