You are here

function token_custom_edit_form_submit in Custom Tokens 5

Same name and namespace in other branches
  1. 6 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 198

Code

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