Updated: Comment #47
First the setup to recreate this problem:
- A sub theme set to the Admin theme
- Another sub theme (with same base theme as admin theme) set as the main front end theme
- Both sub themes have custom theme settings
When changing the theme settings for the front end theme, they are saved and take effect, however when the settings page reloads all the settings for the admin theme are loaded instead, not the front end themes settings.
To show this clearly please watch this video.
@bfroehle summarizes the problem technically in #2:
The theme settings pages are built by system_theme_settings(). This function generates the form by running THEME_system_theme_settings_alter() for the theme you are trying to edit, as well as all of that theme's parents. In each case, $GLOBALS['theme_key'] is set to the name of the theme we're trying to edit.
After the form is initially built, we reset $GLOBALS['theme_key'] to the name of the administration theme, and finish processing the form by calling drupal_alter() which then calls THEME_system_theme_settings_alter() and overwrites the correct sub-theme values.
We need to move away from the drupal_alter() namespace in this case as form alter hooks are the main cause of this issue.
- There is a patch attached to comment #43 that needs help to get passing tests
User interface changes
@JohnAlbin provides a good explantion of the API changes in #34
As discussed in https://drupal.org/node/1164790 if we rename system_theme_settings() to system_theme_config() and THEME_form_system_theme_settings_alter() to THEME_theme_config() (That would also make the module's hook alter be hook_form_system_theme_config_alter().)
FAILED: [[SimpleTest]]: [MySQL] 55,302 pass(es), 101 fail(s), and 5 exception(s).
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 943212-36-admin-themes.patch. Unable to apply patch. See the log in the details link for more information.
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 943212-34-admin-themes.patch. Unable to apply patch. See the log in the details link for more information.
FAILED: [[SimpleTest]]: [MySQL] Invalid PHP syntax in core/includes/module.inc.
FAILED: [[SimpleTest]]: [MySQL] 46,397 pass(es), 35 fail(s), and 577 exception(s).