function mailchimp_campaign_campaign_form_submit in Mailchimp 7.4
Same name and namespace in other branches
- 7.5 modules/mailchimp_campaign/includes/mailchimp_campaign.admin.inc \mailchimp_campaign_campaign_form_submit()
- 7.2 modules/mailchimp_campaign/mailchimp_campaign.admin.inc \mailchimp_campaign_campaign_form_submit()
- 7.3 modules/mailchimp_campaign/includes/mailchimp_campaign.admin.inc \mailchimp_campaign_campaign_form_submit()
Submit handler for mailchimp_campaign_campaign_form().
File
- modules/
mailchimp_campaign/ includes/ mailchimp_campaign.admin.inc, line 275 - Administration pages for mailchimp_campaign module.
Code
function mailchimp_campaign_campaign_form_submit($form, &$form_state) {
$values = $form_state['values'];
$recipients = (object) array(
'list_id' => $values['list_id'],
);
if (isset($values['list_segment_id']) && !empty($values['list_segment_id'])) {
$recipients->segment_opts = (object) array(
'saved_segment_id' => (int) $values['list_segment_id'],
);
}
$settings = (object) array(
'subject_line' => $values['subject'],
'title' => $values['title'],
'from_name' => check_plain($values['from_name']),
'reply_to' => $values['from_email'],
);
$template_content = isset($values['content']) ? _mailchimp_campaign_parse_template_content($values['content']) : array();
$campaign_id = isset($form_state['campaign']) ? $form_state['campaign']->mc_campaign_id : NULL;
mailchimp_campaign_save_campaign($template_content, $recipients, $settings, $values['template_id'], $campaign_id);
cache_clear_all('mailchimp_campaign_campaigns', 'cache');
$form_state['redirect'][] = 'admin/config/services/mailchimp/campaigns';
}