function sharemessage_form_submit in Share Message 7
Share message form submit.
1 string reference to 'sharemessage_form_submit'
- sharemessage_form in ./
sharemessage.module - Share message form.
File
- ./
sharemessage.module, line 403 - New Sharing Module.
Code
function sharemessage_form_submit($form, &$form_state) {
if (!$form_state['values']['override_default_settings']) {
$form_state['values']['settings'] = array();
}
else {
// Set default settings for the addthis counter style.
if ($form_state['values']['settings']['icon_style'] == 'addthis_counter_style') {
$form_state['values']['settings']['services'] = array(
'facebook_like' => 'facebook_like',
'tweet' => 'tweet',
'google_plusone' => 'google_plusone',
);
// Counter will be added anyway for this style.
$form_state['values']['settings']['counter'] = FALSE;
}
}
if (variable_get('sharemessage_message_enforcement', TRUE)) {
$form_state['values']['settings']['enforce_usage'] = $form_state['values']['enforce_usage'];
unset($form_state['values']['enforce_usage']);
}
$sharemessage = $form_state['sharemessage'];
entity_form_submit_build_entity('sharemessage', $sharemessage, $form, $form_state);
sharemessage_save($sharemessage);
$info = entity_get_info('sharemessage');
$form_state['redirect'] = $info['admin ui']['path'];
drupal_set_message(t('Message %title saved.', array(
'%title' => entity_label('sharemessage', $sharemessage),
)));
}