You are here

function token_custom_edit_form_submit in Custom Tokens 7

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

Submit handler for the custom token admin form.

Tries to save the edited token.

_state

Parameters

array $form:

File

./token_custom.admin.inc, line 176
Page callbacks and admin forms of the token_custom module.

Code

function token_custom_edit_form_submit($form, &$form_state) {
  $form_state['values']['is_new'] = $form_state['token_custom']['op'] == 'add';
  if (!token_custom_save($form_state['values'])) {
    drupal_set_message(t('There was a problem saving token <em>@machine_name</em>. Please contact the site administrator.', array(
      '@machine_name' => $form_state['values']['machine_name'],
    )), 'error');
  }
  else {
    drupal_set_message(t('Token <em>@machine_name</em> saved.', array(
      '@machine_name' => $form_state['values']['machine_name'],
    )));
  }
  $form_state['redirect'] = 'admin/structure/token-custom';
}