You are here

function heartbeat_messages_edit_submit in Heartbeat 6.3

Same name and namespace in other branches
  1. 6.4 heartbeat.admin.inc \heartbeat_messages_edit_submit()
  2. 6.2 heartbeat.admin.inc \heartbeat_messages_edit_submit()

Accept the form submission heartbeat messages to edit.

File

./heartbeat.admin.inc, line 380

Code

function heartbeat_messages_edit_submit($form, &$form_state) {

  // Message_id's cannot be changed
  if ($form_state['clicked_button']['#value'] == t('Save')) {

    // Prepare message concatenation variables
    $variables = array(
      'type' => $form_state['values']['type'],
      'group_by' => $form_state['values']['group_by'],
      'group_target' => $form_state['values']['group_target'],
      'merge_separator' => $form_state['values']['merge_separator'],
      'merge_end_separator' => $form_state['values']['merge_end_separator'],
      'perms' => $form_state['values']['perms'],
    );
    if (!empty($form_state['values']['data'])) {
      $variables = array_merge($variables, $form_state['values']['data']);
    }
    $concat_args = heartbeat_encode_message_variables($variables);
    if (db_query("UPDATE {heartbeat_messages} SET message ='%s', message_concat ='%s',\n    description = '%s', module = '%s' , concat_args = '%s', perms = %d\n    WHERE hid = %d", $form_state['values']['message'], $form_state['values']['message_concat'], $form_state['values']['description'], $form_state['values']['module'], $concat_args, $form_state['values']['perms'], $form_state['values']['hid'])) {
      drupal_set_message(t('Settings saved'));
    }
  }

  //$form_state['redirect'] = 'admin/settings/heartbeat/messages';
  return;
}