function newsletter_create_send_form_page_two_submit in Newsletter 7
1 string reference to 'newsletter_create_send_form_page_two_submit'
File
- includes/
newsletter.admin.inc, line 362 - Admin page callbacks for the newsletter module.
Code
function newsletter_create_send_form_page_two_submit($form, &$form_state) {
$title = $form_state['page_values'][1]['title'];
$ntid = $form_state['page_values'][1]['template'];
$changed_subject = $form_state['input']['subject'] != $form_state['values']['subject'];
$changed_body = $form_state['input']['body']['value'] != $form_state['values']['body']['value'];
$changed_format = $form_state['input']['body']['format'] != $form_state['values']['body']['format'];
if ($changed_subject || $changed_body || $changed_format) {
$template = newsletter_template_load($ntid);
$template->subject = $form_state['input']['subject'];
$template->field_newsletter_body[LANGUAGE_NONE][0] = $form_state['input']['body'];
entity_get_controller('newsletter_template')
->save($template);
}
$newsletter = entity_get_controller('newsletter_newsletter')
->create($title, $ntid, TRUE);
$subscribers = $form_state['page_values'][1]['list'] == 'all' ? newsletter_subscriber_load() : newsletter_subscribers_by_list($form_state['page_values'][1]['list']);
if ($form_state['clicked_button']['#value'] == t('Send newsletter now')) {
newsletter_queue_custom_newsletter($subscribers, $newsletter);
}
else {
$mail = !empty($form_state['input']['test-email']) ? $form_state['input']['test-email'] : NULL;
newsletter_send_test($ntid, $mail);
entity_get_controller('newsletter_newsletter')
->saveDraft($subscribers, $newsletter);
}
$form_state['redirect'] = 'admin/config/media/newsletter/create-send';
}