Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
to be able to integrate the color module in a theme in d7 we need to add the following code to template.php (see here)
/**
* Override or insert variables into the page template.
*/
function alpha_process_page(&$vars) {
// Hook into color.module.
if (module_exists('color')) {
_color_page_alter($vars);
}
}
/**
* Override or insert variables into the page template for HTML output.
*/
function alpha_process_html(&$vars) {
// Hook into color.module.
if (module_exists('color')) {
_color_html_alter($vars);
}
}
adding the code above to "alpha/template.php" cancels the need to edit subtheme template.php
Note: patch generated in 7.x-3.0 version
(in my case I read the doc http://drupal.org/node/108459 , but didn't see the comment about d7, so it took me some time to figure out that I need the code in the comment and get the color module working)
Comment | File | Size | Author |
---|---|---|---|
color_module_easier_integration.patch | 850 bytes | ahwebd |
Comments
Comment #1
ahwebd CreditAttribution: ahwebd commentedComment #2
Anticosti CreditAttribution: Anticosti commentedSubscribing
Comment #3
jdufaur CreditAttribution: jdufaur commentedSubscribing
Comment #4
Cellar Door CreditAttribution: Cellar Door commentedComment #5
himerus CreditAttribution: himerus commentedSince Alpha/Omega base theme(s) will never have direct color manipulation except via a subtheme, I feel that this integration is ONLY valid for a subtheme, and should not be a fix against the base theme level.
Any new subtheme, by following docs on integrating color support can do so there, in the subtheme.
Comment #6
Bevan CreditAttribution: Bevan commentedBesides that, it doesn't work, because
_color_page_alter()
doesn't use the Drupal core convention of adding stylesheets withstylesheets[all][]
in the theme's info file. (!?)Comment #7
tierso CreditAttribution: tierso commentedI've tried googling to little avail, could someone please direct me to the "correct/official" docs on this subject? (I'm using the htm5 starter kit)
Comment #8
Bevan CreditAttribution: Bevan commentedtierso: http://drupal.org/node/108459
It is a little out of date for Drupal 7, but still useful. Look at
themes/bartik/color/color.inc
for an example implementation.Comment #9
Bevan CreditAttribution: Bevan commentedRelated; #1677540: Support recoloring of stylesheets
Comment #10
tierso CreditAttribution: tierso commentedThank you very much for the quick answer. Applied the patch but as I suspected, it will only work for alpha based themes (correct me if I'm wrong). I'll have a go at your other suggestion for now.
Comment #11
Bevan CreditAttribution: Bevan commentedI believe omega inherits from alpha, so thus omega sub-themes should work with this too. Note however that this won't magically make a sub-theme recolorable. You still need to add color.inc and various other things into your theme, as per http://drupal.org/node/108459.
Comment #11.0
Bevan CreditAttribution: Bevan commentedminor