You are here

function mail_edit_template_remove_confirm_submit in Mail Editor 7

Executes the template removal.

_state

Parameters

array $form:

File

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

Code

function mail_edit_template_remove_confirm_submit(array $form, array &$form_state) {
  $form_values = $form_state['values'];
  $success = db_delete('mail_edit')
    ->condition('id', $id = $form_values['id'])
    ->condition('language', $lang_code = $form_values['lang_code'])
    ->execute();
  $language_list = mail_edit_language_list();
  $variables = array(
    '%id' => $id,
    '%language' => $language_list[$lang_code],
  );
  $dsm = 'drupal_set_message';

  // Keep Coder happy.
  if (count($language_list) > 1) {
    $dsm(t($success ? '%language translation of %id has been removed.' : 'Failed to remove %language translation of %id.', $variables));
  }
  else {
    $dsm(t($success ? 'Template %id has been removed.' : 'Failed to remove the %id template.', $variables));
  }
  $form_state['redirect'] = 'admin/config/system/mail-edit';
}