You are here

function filter_admin_delete in Drupal 6

Same name and namespace in other branches
  1. 4 modules/filter.module \filter_admin_delete()
  2. 5 modules/filter/filter.module \filter_admin_delete()

Menu callback; confirm deletion of a format.

See also

filter_admin_delete_submit()

Related topics

1 string reference to 'filter_admin_delete'
filter_menu in modules/filter/filter.module
Implementation of hook_menu().

File

modules/filter/filter.admin.inc, line 242
Admin page callbacks for the filter module.

Code

function filter_admin_delete() {
  $format = arg(4);
  $format = db_fetch_object(db_query('SELECT * FROM {filter_formats} WHERE format = %d', $format));
  if ($format) {
    if ($format->format != variable_get('filter_default_format', 1)) {
      $form['format'] = array(
        '#type' => 'hidden',
        '#value' => $format->format,
      );
      $form['name'] = array(
        '#type' => 'hidden',
        '#value' => $format->name,
      );
      return confirm_form($form, t('Are you sure you want to delete the input format %format?', array(
        '%format' => $format->name,
      )), 'admin/settings/filters', t('If you have any content left in this input format, it will be switched to the default input format. This action cannot be undone.'), t('Delete'), t('Cancel'));
    }
    else {
      drupal_set_message(t('The default format cannot be deleted.'));
      drupal_goto('admin/settings/filters');
    }
  }
  else {
    drupal_not_found();
  }
}