function heartbeat_messages_edit_submit in Heartbeat 6.4
Same name and namespace in other branches
- 6.2 heartbeat.admin.inc \heartbeat_messages_edit_submit()
- 6.3 heartbeat.admin.inc \heartbeat_messages_edit_submit()
Accept the form submission heartbeat messages to edit.
File
- ./
heartbeat.admin.inc, line 1223 - Admnistration tasks for heartbeat.
Code
function heartbeat_messages_edit_submit($form, &$form_state) {
// Message_id's cannot be changed
if ($form_state['clicked_button']['#value'] == t('Save') || $form_state['clicked_button']['#value'] == t('Import')) {
$message = new stdClass();
$message->hid = $form_state['values']['hid'];
$message->message_id = $form_state['values']['message_id'];
$message->message = $form_state['values']['message'];
$message->message_concat = $form_state['values']['message_concat'];
$message->perms = $form_state['values']['perms'];
$message->description = $form_state['values']['description'];
$message->tags = $form_state['values']['tags'];
$concat_args = array(
'type' => $form_state['values']['type'],
'group_by' => $form_state['values']['group_by'],
'group_target' => $form_state['values']['group_target'],
'group_by_target' => $form_state['values']['group_by_target'],
'group_num_max' => $form_state['values']['group_num_max'],
'merge_separator' => $form_state['values']['merge_separator'],
'merge_end_separator' => $form_state['values']['merge_end_separator'],
'show_remaining_items' => $form_state['values']['show_remaining_items'],
'roles' => $form_state['values']['roles'],
);
$message->concat_args = $concat_args;
if (!empty($form_state['values']['attachments'])) {
$message->attachments = $form_state['values']['attachments'];
}
if (!empty($form_state['values']['data'])) {
$message->variables = $form_state['values']['data'];
}
if ($form_state['values']['custom'] < HEARTBEAT_MESSAGE_CHANGED) {
$message->custom = $form_state['values']['custom'] + HEARTBEAT_MESSAGE_CHANGED;
}
else {
$message->custom = $form_state['values']['custom'];
}
heartbeat_message_update($message);
drupal_set_message(t('Settings saved'));
}
return;
}