I see this change was just made. Unfortunately, it results in WSOD on admin/build/themes if you have 2 themes that define the same phptemplate_* function. For example, both Garland and Acquia’s Marina define phptemplate_preprocess_page.

And you end up with this error:

Fatal error: Cannot redeclare phptemplate_preprocess_page() (previously declared in themes/garland/template.php:55) in themes/acquia/acquia_marina/template.php on line 300

So you have 2 options:

  1. Never try to determine if all themes have color module support. (Because you can't open more than one template.php file without the possibility of a fatal PHP error.) Or…
  2. Move hook_color() back to color.inc and rewrite color_compatible() and whatever else needs rewriting.

Comments

johnalbin’s picture

Looks like its only color_get_color_hook() and color_compatible() that need re-writing if #2 is chosen.

johnalbin’s picture

Status: Active » Needs work

Came up with a third option…

3. Don't determine if themes have color module support by examining if it has a hook_color function. If the theme has a color/color.inc file, you know it has support for the color module. Of course, you don't know if that support is original or '08 support. So you still need to examine color.inc for something specific to '08. I’m not sure what that something is yet.

johnalbin’s picture

Title: Move hook_color() in template.php back to color.inc » WSOD when checking for hook_color() in template.php

More accurate title.

tonyn’s picture

Correct me if I'm wrong, but why is Garland set at phptemplate_preprocess_page() and not garland_preprocess_page()? It undermines the system. Isn't this a core bug that should be fixed?

Update:

http://drupal.org/node/223430
"It is recommended that base themes use the engine name (7 & 8) for its preprocessor. This makes it easier to move around code between themes and post snippets on Drupal.org."

Why is this the case?

Danial Namousi’s picture

subscribe

tonyn’s picture

http://drupal.org/cvs?commit=149617

OK. I am trying another option (we mentioned this one before in #drupal-themes). Nothing is final, but I wanted to move forward. To my knowledge, this is an OK implementation.

We are checking the theme .info file for color = TRUE (which is $theme->info['color'] = TRUE when it's unserialize'd from DB.

color_list_colorable_themes() has been consolidated into our special list_themes() named color_list_themes(). We can list colorable themes easily because this function pull theme info by default anyway.

color_compatible() will do a DB look up for color = TRUE.