Problem/Motivation

It seems module based implementations of hook_theme_registry_alter are always overriden in the sense that Omega hooks are taking precedence. This might be a problem with my configuration but all of my module implementations of hook_theme_registry_alter worked in AdaptiveTheme before I ported everything to Omega so am still looking for some rationale on what I am doing wrong.

Say for instance I have a module called wetkit_breadcrumbs with the following code defined:

function wetkit_breadcrumbs_theme_registry_alter(&$theme_registry) {
  $theme_registry['breadcrumb']['theme path'] = drupal_get_path('module', 'wetkit_breadcrumbs');
  $theme_registry['breadcrumb']['file'] = drupal_get_path('module', 'wetkit_breadcrumbs') . '/theme/wetkit_breadcrumbs.theme.inc';
  $theme_registry['breadcrumb']['function'] = 'wetkit_breadcrumbs_breadcrumb';
}

Then setting a breakpoint near the beginning and end of the code in omega_theme_registry_alter I can see the following:

Beginning of function:

['registry']['breadcrumb']['file'] = "profiles/wetkit/modules/custom/wetkit_breadcrumbs.theme.inc
['registry']['breadcrumb']['function'] = "wetkit_breadcrumbs_breadcrumb"
['registry']['breadcrumb']['theme path'] = "profiles/wetkit/modules/custom/wetkit_breadcrumbs"

End of function:

['registry']['breadcrumb']['file'] = "profiles/wetkit/modules/custom/wetkit_breadcrumbs.theme.inc
['registry']['breadcrumb']['function'] = "omega_breadcrumb"
['registry']['breadcrumb']['theme path'] = "profiles/wetkit/modules/custom/wetkit_breadcrumbs"

Is there a way for my module to override the Omega theme settings so that the function remains the same as specified inside my module?

https://drupal.org/node/2058597 (Template Inheritance)

CommentFileSizeAuthor
#4 2059213-4.patch565 bytesfubhy
#3 2059213-2.patch565 bytesfubhy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fubhy’s picture

The template inheritance issue is not related to this one. It's a core bug.

Anyways, I will think about this some more today. A potential solution would be to add a optional flag to theme registry entries e.g. "final => TRUE" so that Omega considers it as fully processed already and won't touch it at all.

fubhy’s picture

Status: Active » Needs review

Please check if this patch works for you...

It should allow you to do this:


function wetkit_breadcrumbs_theme_registry_alter(&$theme_registry) {
  $theme_registry['breadcrumb']['theme path'] = drupal_get_path('module', 'wetkit_breadcrumbs');
  $theme_registry['breadcrumb']['file'] = drupal_get_path('module', 'wetkit_breadcrumbs') . '/theme/wetkit_breadcrumbs.theme.inc';
  $theme_registry['breadcrumb']['function'] = 'wetkit_breadcrumbs_breadcrumb';
  $theme_registry['breadcrumb']['final'] = TRUE;
}

fubhy’s picture

FileSize
565 bytes

Forgot to upload the patch.

fubhy’s picture

FileSize
565 bytes

Sorry, incorrect... This is better.

sylus’s picture

Hey @fubhy that patch does indeed correct all of my problems. I really appreciate you taking the time and love the work that is going into Omega 4.x.

I did notice that there is another way module maintainers implement hook_registry_theme_alter but it only modifies the path. Am I correct no fix will be needed for the following to work in Omega? I currently have no problems leveraging this type of hook so guessing it is okay but wanted to clarify.

function wetkit_bean_theme_registry_alter(&$theme_registry) {
  $mod_path = drupal_get_path('module', 'wetkit_bean') . '/templates';
  $theme_registry_copy = $theme_registry;
  _theme_process_registry($theme_registry_copy, 'phptemplate', 'theme_engine', 'pow', $mod_path);
  $theme_registry += array_diff_key($theme_registry_copy, $theme_registry);
}
sylus’s picture

Status: Needs review » Reviewed & tested by the community

Setting to RTBC

fubhy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks.

I am not 100% sure what that code snippet does so don't know what I should answer :P.

Status: Fixed » Closed (fixed)

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