You are here

function token_custom_edit_form_submit in Custom Tokens 6

Same name and namespace in other branches
  1. 5 token_custom.module \token_custom_edit_form_submit()
  2. 7.2 token_custom.admin.inc \token_custom_edit_form_submit()
  3. 7 token_custom.admin.inc \token_custom_edit_form_submit()

File

./token_custom.module, line 199
The Token Custom module.

Code

function token_custom_edit_form_submit($form, &$form_state) {
  if (!$form_state['values']['token_custom_tkid']['storage']) {
    db_query("INSERT INTO {token_custom} (id, description, type, php) VALUES ('%s', '%s', '%s', '%s')", $form_state['values']['token_custom_id'], $form_state['values']['token_custom_description'], $form_state['values']['token_custom_type'], $form_state['values']['token_custom_php']);
  }
  else {
    $tkid = $form_state['values']['token_custom_tkid'];
    db_query("UPDATE {token_custom} SET id = '%s', description = '%s', type = '%s', php = '%s' WHERE tkid = %d", $form_state['values']['token_custom_id'], $form_state['values']['token_custom_description'], $form_state['values']['token_custom_type'], $form_state['values']['token_custom_php'], $tkid);
  }
  drupal_set_message(t('%id saved.', array(
    '%id' => $form_state['values']['token_custom_id'],
  )));
  $form_state['redirect'] = "admin/build/tokens";

  // $form_state['nid'] = $node->nid;
}