system_themes_submit

Versions
4.7
system_themes_submit($form_id, $values)
5
system_themes_submit($form_id, $form_values)

Code

modules/system.module, line 863

<?php
function system_themes_submit($form_id, $values) {

  db_query("UPDATE {system} SET status = 0 WHERE type = 'theme'");

  if ($_POST['op'] == t('Save configuration')) {
    if (is_array($values['status'])) {
      foreach ($values['status'] as $key => $choice) {
        // Always enable the default theme, despite its status checkbox being checked:
        if ($choice || $values['theme_default'] == $key) {
          // If theme status is being set to 1 from 0, initialize block data for this theme if necessary.
          if (db_num_rows(db_query("SELECT status FROM {system} WHERE type = 'theme' AND name = '%s' AND status = 0", $key))) {
            system_initialize_theme_blocks($key);
          }
          db_query("UPDATE {system} SET status = 1 WHERE type = 'theme' and name = '%s'", $key);
        }
      }
    }
    variable_set('theme_default', $values['theme_default']);
  }
  else {
    variable_del('theme_default');
    db_query("UPDATE {system} SET status = 1 WHERE type = 'theme' AND name = 'bluemarine'");
  }

  menu_rebuild();
  drupal_set_message(t('The configuration options have been saved.'));
  return 'admin/themes';
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.