You are here

function simplenews_form_taxonomy_form_term_alter in Simplenews 7

Implements hook_form_FORM_ID_alter().

Add a warning message to taxonomy term delete form.

File

./simplenews.module, line 717
Simplenews node handling, sent email, newsletter block and general hooks

Code

function simplenews_form_taxonomy_form_term_alter(&$form, $form_state) {
  if (isset($form_state['confirm_delete']) && $form_state['confirm_delete']) {
    if ($form['#term']->vocabulary_machine_name == 'newsletter') {
      $category = simplenews_category_load($form['#term']->tid);
      $form['description']['#markup'] = '<p>' . t('This taxonomy term is part of simplenews newsletter category %category_name. Deleting this term will delete the newsletter category and <strong>all subscriptions to category %category_name</strong>. This action cannot be undone.', array(
        '%category_name' => _simplenews_newsletter_name($category),
      )) . '</p>' . $form['description']['#markup'];
    }
  }
}