You are here

function themekey_compat_settings_form_submit in ThemeKey 7

Same name and namespace in other branches
  1. 7.3 themekey_compat_admin.inc \themekey_compat_settings_form_submit()
  2. 7.2 themekey_compat_admin.inc \themekey_compat_settings_form_submit()

Form submission handler for themekey_compat_settings_form().

See also

themekey_compat_settings_form()

File

./themekey_compat_admin.inc, line 84
@author Markus Kalkbrenner | Cocomore AG

Code

function themekey_compat_settings_form_submit($form, &$form_state) {
  $modules_enabled = array();
  $modules_no_default_theme = array();
  foreach ($form_state['values']['themekey_compat_modules_enabled'] as $module => $enabled) {
    if ($enabled) {
      $modules_enabled[] = $module;
    }
  }
  variable_set('themekey_compat_modules_enabled', $modules_enabled);
  if (!empty($modules_enabled)) {
    drupal_set_message(t('You integrated some modules in Theme Switching Rule Chain. !link', array(
      '!link' => l(t('Review the Theme Switching Rule Chain.'), 'admin/config/user-interface/themekey/properties'),
    )), 'warning');
  }
  foreach ($form_state['values']['themekey_compat_modules_no_default_theme'] as $module => $enabled) {
    if ($enabled) {
      $modules_no_default_theme[] = $module;
    }
  }
  variable_set('themekey_compat_modules_no_default_theme', $modules_no_default_theme);
  module_load_include('inc', 'themekey', 'themekey_build');
  themekey_rebuild();
  foreach ($form_state['values']['themekey_compat_modules_enabled'] as $module => $enabled) {
    themekey_update_static_rule('themekey_compat:module_' . $module . '_triggers_theme', $enabled);
  }
  cache_clear_all('module_implements', 'cache_bootstrap');
  drupal_set_message(t('The configuration options have been saved.'));
}