You are here

function _omega_tools_theme_reset_submit in Omega Tools 7.2

Same name and namespace in other branches
  1. 7 omega_tools.module \_omega_tools_theme_reset_submit()

Submit handler for theme reset

1 string reference to '_omega_tools_theme_reset_submit'
_omega_tools_theme_reset_form in ./omega_tools.module
Create a form to reset the theme settings in the database

File

./omega_tools.module, line 162

Code

function _omega_tools_theme_reset_submit($form, $form_state) {
  $theme = $form_state['values']['theme'];

  // set our redirect
  $form_state['redirect'] = '/admin/appearance/settings/' . $theme;

  // remove the stored DB copy of the theme settings that have been modified
  variable_del('theme_' . $theme . '_settings');

  // clear the cache in case that will help
  drupal_flush_all_caches();

  // rebuild the theme information
  system_rebuild_theme_data();

  // clear the cache in case that will help
  drupal_flush_all_caches();

  // report to the log
  watchdog('theme', 'Theme settings for %theme reset to default values.', array(
    '%theme' => $theme,
  ));

  // make a nice message to say it happened, and log to the system
  drupal_set_message('Theme settings for <strong>' . $form_state['values']['theme'] . '</strong> have been reset...');

  // go back to the primary settings page for this theme
  drupal_redirect_form($form_state);
}