2

I've created a subtheme of the Premium Responsive theme. It was working fine until I tried to change some of the advanced theme settings within the subtheme's Appearance page. The parent theme adds settings for configuring social icons, a slideshow, etc., but unchecking some of the custom options and submiting the form resulted in a message saying "The configuration options have been saved", but the settings were returned to checked.

At first, I thought I needed to copy the theme-settings.php to my subtheme and customize it, but that results in two sets of settings displaying on the Appearance page, one for the parent theme and one for the subtheme (plus, still neither set of settings would stay unchecked when I submitted the form). This seems odd, since the Creating a sub-theme documentation, says "Theme settings set via advanced theme settings' theme-settings.php are not inherited."

So, how am I supposed to set custom theme settings within a subtheme? Do I need to implement a theme-settings.php file within the subtheme or not?

2

I ran into the same issue. After doing an analysis I found the following:

  1. THEME_form_system_theme_settings_alter is called for the base theme and then for the sub theme. It's not really a hook as they say - "Implements hook_form_FORM_ID_alter().".
  2. The base theme uses things like theme_get_setting('asdf_asdf', 'responsive') to get the default values for the settings form.
  3. The settings you're saving are saved for the sub theme.
  4. In templates settings are returned also using theme_get_setting('asdf_asdf', 'responsive').

Because of #2 and #3 the settings appear to not be saved.

Maybe they should have used theme_get_setting('asdf_asdf'). So it will default to the current theme. It can be used in both cases: #2 and #4. It would have worked fine.

For the sake of not altering the theme and because of #4, I would remove the extra settings in SUB_THEME_form_system_theme_settings_alter so you can modify the settings only in the base theme configuration page.

  • I posted an issue for this: drupal.org/node/2159683 – mfernea Dec 19 '13 at 8:39
  • Thanks - This can also be applied to any sub-theme you are creating where the parent has theme settings. – Wavesailor Feb 15 '16 at 18:04
0

You can also use the module magic although it's not always exporting the correct code. In any case it provides a fast solution.

0

you can set your current theme variable set as parent theme variable

$theme_subtheme_settings = variable_get('theme_subtheme_settings', array());   
if(empty($theme_oswsubtheme_settings)){
    $theme_parent_settings = variable_get('theme_parent_settings', array());
    variable_set('theme_subtheme_settings', $theme_parent_settings); 
  }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.