I'm running into some issues with the Easy Chart module. This is my use case:

In the module, I have a View that appears in a popup. In that popup, I want to use a clean template, so no headers and footers etc. For that purpose, I implement hook_theme_registry_alter, and tell that page to use my custom template that is inculded in the module:

function easychart_theme_registry_alter(&$theme_registry) {
  // Add 'page--editor-easychart.tpl.php' template file
  $theme_registry['page__easychart_charts'] = array();
  $theme_registry['page__easychart_charts']['template'] = 'page--easychart-charts';
  $theme_registry['page__easychart_charts']['path'] = drupal_get_path('module', 'easychart') . "/theme";
  $theme_registry['page__easychart_charts']['render element'] = 'page';
  $theme_registry['page__easychart_charts']['base hook'] = 'page';
  $theme_registry['page__easychart_charts']['type'] = 'module';
  $theme_registry['page__easychart_charts']['theme path'] = drupal_get_path('module', 'easychart') . "/theme";
  $theme_registry['page__easychart_charts']['override preprocess functions'] = TRUE;
}

This overwrite is unfortunately ignored when using the Omega theme. After going through the entire flow, I realized that the function omega_process_page in omega/omega/process/page.process.inc is the culprit:

function omega_process_page(&$variables) {
    if ($layout = omega_layout()) {
      $variables['theme_hook_suggestions'][] = 'omega_page_layout';
      $variables['omega_layout'] = $layout;
    }
}

By adding this suggestion at the end of the entire flow, it seems impossible for me to define a page template in my module.

I checked the issue https://drupal.org/node/2059213 but this does not affect my issue.

I am not sure of a good solution for this, do you have any advise please?

Comments

fubhy’s picture

Category: Bug report » Support request
Status: Active » Fixed

That function only adds the theme hook suggestion if you use the Layouts extension that ships with Omega. Do you use that extension?

If you do, you could use hook_omega_layout_alter(&$layout) and set $layout to NULL on the page that you want your custom theme hook suggestion to work. Alternatively, you could just add your page theme hook suggestion in $variables['theme_hook_suggestion'] (note: singular, not plural). That overrides the array given in "theme_hook_suggestions" in any case (it's basically the king among theme hook suggestions, either you define a hierarchy in the array ['theme_hook_suggestions'] or you define a specific one that you are 100% sure you want to use in ['theme_hook_suggestion'].

jyve’s picture

Great! Thanks for the help, $variables['theme_hook_suggestion'] did the job.

Status: Fixed » Closed (fixed)

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