You are here

scs.admin.inc in Simplenews Content Selection 6.2

Same filename and directory in other branches
  1. 8 scs.admin.inc
  2. 6 scs.admin.inc
  3. 7.2 scs.admin.inc
  4. 7 scs.admin.inc

File

scs.admin.inc
View source
<?php

/*
 * @file
 * Select Drupal content to create a newsletter
 */

/*
 * Admin settings form
 */
function scs_admin_settings_form() {
  $form = array();
  $form['scs_content_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Content types'),
    '#description' => t('Select the content types that must be avaiable for node selection'),
    '#options' => _scs_get_node_types(),
    '#default_value' => variable_get('scs_content_types', array()),
  );
  $form['scs_format'] = array(
    '#type' => 'radios',
    '#title' => t('Newsletter format'),
    '#description' => t('Select the format of the newsletters you want to send'),
    '#options' => array(
      'plain' => t('Plain'),
      'html' => t('HTML'),
    ),
    '#default_value' => variable_get('scs_format', 'plain'),
  );
  $form['scs_publish_default'] = array(
    '#type' => 'select',
    '#title' => t('Default publish setting for created newsletters'),
    '#description' => t('Change this select to unpublished if you want to not publish the newsletter node at creation.'),
    '#options' => array(
      0 => t('Unpublished'),
      1 => t('Published'),
    ),
    '#default_value' => variable_get('scs_publish_default', 1),
  );
  $form['scs_default_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Default title for created newsletters'),
    '#description' => t('If filled, this title will be used to populate "title" field when creating a newsletter.'),
    '#default_value' => variable_get('scs_default_title', ''),
  );
  $form['types'] = array(
    '#type' => 'fieldset',
    '#title' => t('Theming'),
    '#collapsible' => TRUE,
  );
  $form['types']['scs_types'] = array(
    '#type' => 'textarea',
    '#title' => t('Newsletter types'),
    '#description' => t('SCS allows you to create newsletters with existing content. With newsletter types you can create multiple types of newsletters, each type will have his own theme function, so you can generate different layouts while you are still using one subscribers list or place to select. One type per line.'),
    '#default_value' => variable_get('scs_types', ''),
  );

  //Addon functionality
  foreach (module_implements('scs_addon_settings') as $name) {
    $function = $name . '_scs_addon_settings';
    $addonform = $function();
    $form[$name] = array(
      '#type' => 'fieldset',
      '#title' => $name,
      '#collapsible' => TRUE,
    );
    $form[$name] = array_merge($form[$name], $addonform);
  }
  return system_settings_form($form);
}

/*
 * Return avaiable node types in option list
 */
function _scs_get_node_types() {
  $options = array();
  foreach (node_get_types() as $name => $type) {
    $options[$name] = $type->name;
  }
  return $options;
}