Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.474 diff -u -p -r1.474 system.module --- modules/system/system.module 6 May 2007 05:47:52 -0000 1.474 +++ modules/system/system.module 9 May 2007 08:10:38 -0000 @@ -2202,16 +2202,20 @@ function system_theme_settings($key = '' // Template-specific settings $function = $themes[$key]->prefix .'_settings'; if (function_exists($function)) { - if ($themes[$key]->template) { + if (!empty($themes[$key]->template)) { // file is a template or a style of a template - $form['specific'] = array('#type' => 'fieldset', '#title' => t('Engine-specific settings'), '#description' => t('These settings only exist for all the templates and styles based on the %engine theme engine.', array('%engine' => $themes[$key]->prefix))); + $group = $function(); + if (!empty($group)) { + $form['engine_specific'] = array('#type' => 'fieldset', '#title' => t('Engine-specific settings'), '#description' => t('These settings only exist for all the templates and styles based on the %engine theme engine.', array('%engine' => $themes[$key]->prefix))); + $form['engine_specific'] = array_merge($form['engine_specific'], $group); + } } - else { - // file is a theme or a style of a theme - $form['specific'] = array('#type' => 'fieldset', '#title' => t('Theme-specific settings'), '#description' => t('These settings only exist for the %theme theme and all the styles based on it.', array('%theme' => $themes[$key]->prefix))); + // file is a theme or a style of a theme + $group = $function($key); + if (!empty($group)) { + $form['theme_specific'] = array('#type' => 'fieldset', '#title' => t('Theme-specific settings'), '#description' => t('These settings only exist for the %theme theme and all the styles based on it.', array('%theme' => !empty($themes[$key]->info['base theme']) ? $themes[$themes[$key]->info['base theme']]->info['name'] : $themes[$key]->info['name']))); + $form['theme_specific'] = array_merge($form['theme_specific'], $group); } - $group = $function(); - $form['specific'] = array_merge($form['specific'], (is_array($group) ? $group : array())); } } $form['#attributes'] = array('enctype' => 'multipart/form-data'); Index: themes/engines/phptemplate/phptemplate.engine =================================================================== RCS file: /cvs/drupal/drupal/themes/engines/phptemplate/phptemplate.engine,v retrieving revision 1.65 diff -u -p -r1.65 phptemplate.engine --- themes/engines/phptemplate/phptemplate.engine 6 May 2007 05:47:52 -0000 1.65 +++ themes/engines/phptemplate/phptemplate.engine 9 May 2007 08:10:38 -0000 @@ -75,3 +75,27 @@ function phptemplate_engine_preprocess(& $variables['directory'] = path_to_theme(); $variables['is_front'] = drupal_is_front_page(); } + +/** + * Adds additional form elements to a theme settings page. + * + * @param $key + * The name of the theme. + */ +function phptemplate_settings($key = NULL) { + $form = array(); + if (!empty($key)) { + $themes = list_themes(); + // Determine if the $key theme has a base theme. + $base = !empty($themes[$key]->base_theme) ? $themes[$key]->base_theme : $key; + // Get the base theme's directory. + $dir = str_replace("/$base.info", '', $themes[$base]->filename); + if (file_exists("./$dir/settings.php")) { + $variables = theme_get_settings($key); + // Allow settings.php file to add items to the $form variable. + include "./$dir/settings.php"; + } + } + return $form; +} +