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.
This patch will allow PHPTemplate based themes to add their own settings fields to the admin/themes/settings/
configuration form. This will allow these themes to provide a UI for changing things like alternate color schemes or alternate layouts.
Comment | File | Size | Author |
---|---|---|---|
#2 | phptemplate_per_theme_settings.patch | 870 bytes | jfitzell |
phptemplate.engine_7.patch | 1.02 KB | dreed47 | |
Comments
Comment #1
forngren CreditAttribution: forngren commentedI haven't tested it due lack of time, but I was going to spend my summer building something simular. Looks great! But should we perheps add some theme-related forms to the forms-api (eg colorselector, fontselector, etc)?
Cheers Johan F
Comment #2
jfitzell CreditAttribution: jfitzell commentedThis is a slightly modified version that looks the the URL to get the theme being edited instead of using the default theme. A slight hack, perhaps, but I don't see any better way without changing the core to pass the theme that is being looked for through to this function. I'd be happy to hear a better suggestion.
Comment #3
Heine CreditAttribution: Heine commentedI cannot patch right now, but from the code (and http://drupal.org/node/57676) it seems that you can encounter fatal errors when redeclaring functions, for example when template.php of the current theme and template.php of the configured theme both contain function phptemplate_something.
Comment #4
adrian CreditAttribution: adrian commentedPHPTemplate is now in drupal core, so this should be a Drupal:Theme System issue.
And i don't support this patch, due to the last problem mentioned. You can not reliably load another theme in the same session, while you are able to configure a theme other than the one you have loaded.
Comment #5
jfitzell CreditAttribution: jfitzell commentedThe code looks for
_settings(), not phptemplate_settings(), so loading multiple templates wouldn't be a problem. It is possible that it might conflict with a module of the same name of course. We could always use phptemplate_
_settings() or something; I don't really care what the naming scheme is but that should be a solveable issue...
Comment #6
jfitzell CreditAttribution: jfitzell commentedThe code looks for
_settings(), not phptemplate_settings(), so loading multiple templates wouldn't be a problem. It is possible that it might conflict with a module of the same name of course. We could always use phptemplate_
_settings() or something; I don't really care what the naming scheme is but that should be a solveable issue...
Comment #7
Heine CreditAttribution: Heine commentedIf theme 1 is active and overrides comment_form (ie, declares phptemplate_comment_form) and you want to set settings of theme 2 then you will get a fatal error if theme 2 also overrides comment_form (phptemplate_comment_form)
It's not the function_exists that's the problem, it's
Comment #8
jfitzell CreditAttribution: jfitzell commentedAh, good point.
Could we load a different file to get the settings from then, or something?
Comment #9
forngren CreditAttribution: forngren commentedHm, why not settings.tpl.php?
(I didn't quite understand how themes overwrites each others settings, if someone can explain that further I'll look into it)
Comment #10
KNK CreditAttribution: KNK commentedI have tested this patch (phptemplate_per_theme_settings.patch form jfitzell's comment-118316) and got what I needed, but the call to the 'theme_settings' function should also include the $key as parameter:
- return $function();
+ return $function($key);
this way it is possible to use it's value to return the template specifc settings or system defaults if omited. Well for the last one to work, some changes to system.module are required too.
Comment #11
forngren CreditAttribution: forngren commented19 days before code freeze... C'mon people, we can do this.
I'll take a look at the code/pathces tomorrow and if everything goes well I might be able to present some code. However, I'm gonna need help with testing it.
KNK: I like your approach, it would be nice if we could discuss it. You can reach me at: http://drupal.org/user/40238/contact or skype/#drupal; forngren
Cheer!
Comment #12
fgmI've recently created a more generic solution to the theme settings problem, that works with both PHPtemplate and plain PHP themes.
It essentially introduces an equivalent to the late hook_settings for modules. Maybe deriving something from it would be the best solution ? After all, adding form fields to the already crowded theme configuration form degrades the UI.
Comment #13
fgmThe module is available from http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/fgm/themesett...
Comment #14
bradlis7 CreditAttribution: bradlis7 commentedI think color.module could do this if it was more generic. Right now, I'm pretty displeased with the module, because of it's very Garland oriented approach, which makes it hard for other themes to use. I've submitted an issue on it though, but I have not received a reply.
I'd really like to see the ability for themes to add settings. Maybe there could be some sort of hook, like hook_form_alter, but for themes.
+1 for functionality.
Comment #15
mlncn CreditAttribution: mlncn commentedHas this issue been taken up somewhere else, or is it stalled? In general, it seems like a good idea.
~ ben :: http://AgaricDesign.com
Comment #16
forngren CreditAttribution: forngren commentedMarking this as dupe of http://drupal.org/node/57676 since there's actually some code there.