Attached patch allows for custom or theme-specific settings without having to alter theme-settings.php and template.php. To do so it will search for a theme-settings-custom.php which contains the phptemplate_settings_custom function. Using this function you can alter $form. Here an example of such a theme-settings-custom.php:
<?php
function phptemplate_settings_custom($form) {
$form['tnt_container']['seo']['meta']['#description'] = "test";
return $form;
}
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | acquia_marina_custom_settings_more.patch | 2.58 KB | wmostrey |
| #5 | acquia_marina_custom_settings.patch | 929 bytes | wmostrey |
| #1 | acquia_marina_custom_settings.patch | 928 bytes | wmostrey |
| acquia_marina_custom_settings.patch | 917 bytes | wmostrey |
Comments
Comment #1
wmostrey commentedHere is an updated version of the patch since we will also need $settings. Here an example of a theme-settings-custom.php:
Comment #2
sociotech commentedWim, how does this approach deal with the need for a matching reference for each theme setting in template.php theme initialization section as well?
Comment #3
wmostrey commentedHi Chris,
Since the idea is to have the same template.php for each theme we can't add the option there. Take a look at this theme-settings-custom.php. Here's a consequence of having the same template.php with no defaults for the custom options:
'#default_value' => $settings['theme_width'] ? $settings['theme_width'] : 'fixed'In most cases you will do something similar in page.tpl.php: setting the default value there instead of setting it in template.php.
Comment #4
domesticat commentedFYI - patch will need a reroll for anyone using 6.x-dev versions from February 13 and later.
Comment #5
wmostrey commentedHere is a re-roll of the patch for the latest dev version.
Comment #6
wmostrey commentedHere's another take, taking comment #2 into account: we add an extra function and a function call to template.php and theme-settings.php. Would this be a better solution than adding the code to page.tpl.php?
Here is an example theme-settings-custom.php:
Comment #7
jwolf commentedThanks Wim!
This is in the 2.x branch