You are here

function newsletter_create_send in Newsletter 7

Menu callback; multistep form to create and send a custom newsletter.

1 string reference to 'newsletter_create_send'
newsletter_menu in ./newsletter.module
Implements hook_menu().

File

includes/newsletter.admin.inc, line 270
Admin page callbacks for the newsletter module.

Code

function newsletter_create_send($form, &$form_state) {
  if (!empty($form_state['step']) && $form_state['step'] == 2) {
    return newsletter_create_send_form_page_two($form, $form_state);
  }
  $templates = db_query('SELECT ntid, subject
    FROM {newsletter_template}
    WHERE basic = 0')
    ->fetchAllKeyed();
  $lists['all'] = t('All subscribers');
  $lists += db_query('SELECT nlid, title FROM {newsletter_list}')
    ->fetchAllKeyed();
  $form_state['step'] = 1;
  $form['title'] = array(
    '#title' => t('Title'),
    '#type' => 'textfield',
    '#required' => TRUE,
    '#description' => t('A unique newsletter title'),
  );
  $form['template'] = array(
    '#title' => t('Template'),
    '#type' => 'select',
    '#required' => TRUE,
    '#description' => t('Select the template this newsletter will use'),
    '#options' => array_map('check_plain', $templates),
  );
  $form['list'] = array(
    '#title' => t('Subscriber list'),
    '#type' => 'select',
    '#required' => TRUE,
    '#description' => t('Select the subscriber list this newsletter will use'),
    '#options' => array_map('check_plain', $lists),
  );
  $form['preview'] = array(
    '#type' => 'submit',
    '#value' => t('Preview'),
    '#submit' => array(
      'newsletter_create_send_next_submit',
    ),
  );
  $form['cancel'] = array(
    '#type' => 'link',
    '#title' => t('Cancel'),
    '#href' => 'admin/config/media/newsletter/create-send',
  );
  return $form;
}