You are here

function simplenews_admin_settings in Simplenews 6

Same name and namespace in other branches
  1. 5 simplenews.module \simplenews_admin_settings()
  2. 6.2 includes/simplenews.admin.inc \simplenews_admin_settings()

Menu callback: Simplenews admin settings - General.

1 string reference to 'simplenews_admin_settings'
simplenews_menu in ./simplenews.module
Implementation of hook_menu().

File

./simplenews.admin.inc, line 741
Newsletter admin, subscription admin, simplenews settings

Code

function simplenews_admin_settings(&$form_state) {
  $vid = variable_get('simplenews_vid', '');
  $address_default = variable_get('site_mail', ini_get('sendmail_from'));
  $form = array();
  $form['simplenews_general_settings']['simplenews_content_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Content types'),
    '#required' => TRUE,
    '#options' => array_map('check_plain', node_get_types('names')),
    '#default_value' => variable_get('simplenews_content_types', array(
      'simplenews' => 'simplenews',
    )),
    '#description' => t('Content types to be used as newsletter.'),
  );
  $vocabulary_options = array(
    '' => t('<select>'),
  );
  if ($vocabularies = taxonomy_get_vocabularies()) {
    foreach ($vocabularies as $key => $object) {
      $vocabulary_options[$key] = $object->name;
    }
  }
  $form['simplenews_general_settings']['simplenews_vid'] = array(
    '#type' => 'select',
    '#title' => t('Newsletter vocabulary'),
    '#options' => $vocabulary_options,
    '#required' => TRUE,
    '#description' => t('This vocabulary identifies newsletter series. Note that changing this vocabulary will require existing newsletters to be re-tagged and activated newsletter blocks to be re-activated.'),
    '#default_value' => variable_get('simplenews_vid', ''),
  );

  // Node type settings require pre-processing.
  // simplenews_admin_settings_submit() is called before system_settings_form_submit().
  $form['#submit'][] = 'simplenews_admin_settings_submit';
  return system_settings_form($form);
}