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 8 May 2007 09:26:40 -0000 @@ -2204,14 +2204,18 @@ function system_theme_settings($key = '' if (function_exists($function)) { if ($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' => ($themes[$key]->template) ? $key : $themes[$key]->prefix))); + $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 8 May 2007 09:26:40 -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(); + if (isset($themes[$key])) { + // Determine if the $key theme is a sub-theme of a phptemplate theme. + $dir = strstr($themes[$key]->filename, 'page.tpl.php') ? $themes[$key]->filename : $themes[$key]->description; + $dir = str_replace('/page.tpl.php', '', $dir); + if (file_exists("./$dir/settings.php")) { + // Allow settings.php file to add items to the $form variable. + include "./$dir/settings.php"; + } + } + } + return $form; +} +