function mailchimp_activity_entity_form_submit in Mailchimp 7.2
Same name and namespace in other branches
- 7.5 modules/mailchimp_activity/includes/mailchimp_activity.admin.inc \mailchimp_activity_entity_form_submit()
- 7.3 modules/mailchimp_activity/includes/mailchimp_activity.admin.inc \mailchimp_activity_entity_form_submit()
- 7.4 modules/mailchimp_activity/includes/mailchimp_activity.admin.inc \mailchimp_activity_entity_form_submit()
Submit handler for mailchimp_activity_entity_form().
File
- modules/
mailchimp_activity/ mailchimp_activity.admin.inc, line 166 - Administration pages for mailchimp_campaign module.
Code
function mailchimp_activity_entity_form_submit($form, &$form_state) {
$values = $form_state['values'];
$activity_entity = array();
if ($form_state['op'] == 'add' || $form_state['op'] == 'clone') {
$dummy = entity_create($form_state['values']['entity_type'], array(
'type' => $form_state['values']['bundle'],
));
$uri = entity_uri($form_state['values']['entity_type'], $dummy);
$values['entity_path'] = $uri['path'];
$activity_entity = entity_create('mailchimp_activity_entity', $values);
}
else {
$activity_entity = $form_state['mailchimp_activity_entity'];
foreach ($values as $key => $val) {
$activity_entity->{$key} = $val;
}
}
$activity_entity
->save();
menu_rebuild();
//Otherwise user has to clear cache themselves to see newly created activity pages
$form_state['redirect'] = 'admin/config/services/mailchimp/activity';
}