[development] Custom Theme Settings

John drupal.user at albin.net
Fri May 11 06:57:14 UTC 2007


Custom theme settings are something that are currently possible, but  
don't work terribly well in PHPTemplate.

Although it's not documented, you can add a phptemplate_settings()  
function to your theme's template.php and add custom settings. BUT,  
you can't edit settings of non-active themes because you would get  
function re-declaration errors if you were to try including both the  
active and non-active theme's template.php file. So a separate file  
is really needed to hold each theme's settings.

I believe the best solution to this issue is to:

1. Change system_theme_settings() to allow both engine-specific
    and theme-specific settings for any theme. Currently, if
    the theme is based on an engine, system_theme_settings()
    will only add engine-specific settings.
2. Add phptemplate_settings() to the PHPTemplate engine and,
    using the $key passed by system_theme_settings(), look in
    the $key theme's directory and include and return the
    contents of a settings.php file.

I've made a patch for Drupal 6.  If you want to review, contribute,  
(or commit :-D ), take a look at the issue, patch and example  
settings.php file here: http://drupal.org/node/57676

- John (JohnAlbin)


BTW, if you want a solution to this issue for Drupal 5, see my Theme  
Settings API module at http://drupal.org/project/themesettings



More information about the development mailing list