You are here

function simplenews_admin_settings_submit in Simplenews 6.2

Same name and namespace in other branches
  1. 6 simplenews.admin.inc \simplenews_admin_settings_submit()
1 string reference to 'simplenews_admin_settings_submit'
simplenews_admin_settings in includes/simplenews.admin.inc
Menu callback: Simplenews admin settings - General.

File

includes/simplenews.admin.inc, line 886
Newsletter admin, subscription admin, simplenews settings

Code

function simplenews_admin_settings_submit($form, &$form_state) {

  // Newsletter vocabulary is updated using node type settings.
  $vocabulary = (array) taxonomy_vocabulary_load($form_state['values']['simplenews_vid']);
  $form_state['values']['simplenews_content_types'] = array_filter($form_state['values']['simplenews_content_types']);
  $vocabulary['nodes'] = $form_state['values']['simplenews_content_types'];

  // Set vocabulary required values
  $vocabulary['multiple'] = FALSE;
  $vocabulary['required'] = TRUE;
  $vocabulary['tags'] = FALSE;
  taxonomy_save_vocabulary($vocabulary);
  variable_set('simplenews_content_types', $form_state['values']['simplenews_content_types']);

  // We do not need a simplenews_content_types variable.
  unset($form_state['values']['simplenews_content_types']);
  drupal_set_message(t('Updated vocabulary %name.', array(
    '%name' => $vocabulary['name'],
  )));
  watchdog('simplenews', 'Updated vocabulary %name.', array(
    '%name' => $vocabulary['name'],
  ), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/edit/vocabulary/' . $form_state['values']['simplenews_vid']));
}