You are here

function mail_edit_purge_mailkey_submit in Mail Editor 7

Submit handler for purging a mail template.

_state

Parameters

array $form:

Return value

void

File

./mail_edit.admin.inc, line 703
Administrative interface for the Mail Editor module.

Code

function mail_edit_purge_mailkey_submit(array $form, array &$form_state) {
  $id = $form_state['values']['mailkey'];
  $count = db_delete('mail_edit')
    ->condition('id', $id)
    ->execute();
  $count += db_delete('mail_edit_registry')
    ->condition('id', $id)
    ->execute();
  if ($count > 0) {
    drupal_set_message(t('The %mailkey template has been purged.', array(
      '%mailkey' => $id,
    )));
    cache_clear_all('mail_edit_registry', 'cache');
  }
  else {
    drupal_set_message(t('The %mailkey template was not found.', array(
      '%mailkey' => $id,
    )));
  }
  unset($_SESSION['mail_edit']['module']);
  $form_state['redirect'] = 'admin/config/system/mail-edit';
}