A sub-theme is supposed to inherit the default theme settings of its base themes. So if a base theme has a setting in its .info file like so:
settings[zen_skip_link_anchor] = main-menu
then a sub-theme of that base theme doesn't need to repeat that line in its .info file.
This becomes critical when a base theme adds a new theme setting. The functionality can depend on a value being set, but, currently, the sub-theme does not properly inherit that theme setting value.
Drupal tries to find the base themes' setting values in theme_get_setting(), but fails because it is expecting an array of the sub-theme's base themes in
$theme_object->base_themes. That array is only sometimes available from list_themes, as it conditionally gets its list of themes from either system_list() or _system_rebuild_theme_data().
_system_rebuild_theme_data() determines the base themes array using a helper function, system_find_base_themes(). We need system_list() to start using that helper function too. Unfortunately, system_list is in core/includes/modules.inc, so we have to move system_find_base_themes() from system.module to theme.inc. We also have to rename it to drupal_find_base_themes() so it makes sense in its new home.
Someone to RTBC the patch!
This is really easy to test if add a text field to a base theme and set the default value for that new text field in the base theme's .info file. Before the patch, you won't see the text field have any value in any sub-theme's settings form. And after the patch is applied, the sub-theme's settings form will show the base theme's default value.
To make it super easy to review, you can download a base theme/sub-theme combo that has these settings already configured. (Attached in comment #19 below.)
- Download and install those 2 themes. http://drupal.org/files/test-themes.tgz
- Enable both themes
- Look at the base theme's "Settings" form. Look at the missing value in the sub-theme's "Settings" form.
- Apply the patch and visit admin/appearance to clear the .info file cache.
- Look at the no-longer-missing value in the sub-theme's "Settings" form.
- Mark this issue RTBC.
User interface changes
A sub-theme's settings form will now have the correct values set by default. Yayz!
Rename system_find_base_themes() to drupal_find_base_themes().
Original report by JohnAlbin
Over inwe discovered a regression such that a base theme's settings are ignored when using theme_get_setting().
list_themes() used to return a fully-loaded theme object that included an array of base themes in the 'base_themes' key, but it no longer does. I'm not sure how the regression was introduced at this point, but looking at the code it seems we have different data being returned depending on if the database is active or not. In other words, _system_rebuild_theme_data() returns sufficient data, but system_list() returns inadequate data.
For the record: list_themes(), system_rebuild_theme_data(), _system_rebuild_theme_data(), system_list('theme'), and _system_theme_list() all return various lists of themes.
So we've got a bit of a mess. I'm still investigating.
PASSED: [[SimpleTest]]: [MySQL] 39,116 pass(es).
FAILED: [[SimpleTest]]: [MySQL] 38,945 pass(es), 44 fail(s), and 368 exception(s).
FAILED: [[SimpleTest]]: [MySQL] 38,996 pass(es), 0 fail(s), and 57 exception(s).
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch theme-object-data-761608-34.patch. Unable to apply patch. See the log in the details link for more information.
FAILED: [[SimpleTest]]: [MySQL] 37,883 pass(es), 6 fail(s), and 114 exception(s).