function magic_export_settings_submit in Magic 7.2
Same name and namespace in other branches
- 7 magic.module \magic_export_settings_submit()
Submit handler for the theme settings export form.
File
- includes/
magic.export.inc, line 48 - Form and utility functions for exporting theme settings.
Code
function magic_export_settings_submit($form, &$form_state) {
$info = $form_state['values']['info'];
$theme = $form['theme']['#value'];
$path = drupal_get_path('theme', $theme);
// Only mark that the settings have updated if the file saved.
if (!file_unmanaged_save_data($info, "{$path}/{$theme}.info", FILE_EXISTS_REPLACE)) {
drupal_set_message(t("The theme's .info file could not be saved, an error has occurred."), 'error');
return;
}
// Since we exported the file, we want to delete the settings variable. This
// will get remade whenever we want to edit the settings in the future, but
// can always be re-removed.
variable_del("theme_{$theme}_settings");
// Rebuild the system .info file information.
system_rebuild_theme_data();
drupal_set_message(t("The theme's .info file has been updated."));
$form_state['redirect'] = "admin/appearance/settings/{$theme}";
}