You are here

function customfilter_rule_delete in Custom filter 6

Same name and namespace in other branches
  1. 7.2 customfilter.module \customfilter_rule_delete()
  2. 7 customfilter.module \customfilter_rule_delete()

Return the replacement rule delete form.

1 string reference to 'customfilter_rule_delete'
customfilter_menu in ./customfilter.module
Implements hook_menu().

File

./customfilter.admin.inc, line 390
Administration page callbacks for Custom filter.

Code

function customfilter_rule_delete($form_state, $rid) {
  $filters = _customfilter_get_filters();
  $rule = db_fetch_object(db_query("SELECT * FROM {customfilter_rule} WHERE rid = %d", $rid));
  $rules_count = db_result(db_query("SELECT COUNT(*) FROM {customfilter_rule} WHERE prid = %d", $rid));
  if ($rule === FALSE) {
    drupal_set_message(t('The replacement rule has been deleted.'));
    drupal_goto('admin/settings/customfilter');
  }
  $form = array(
    '#fid' => $rule->fid,
    '#rid' => $rid,
  );
  if ($rules_count) {
    $msg_text .= t('This rule has subrules. If you delete this rule, they will be deleted too.');
  }
  $msg_text .= t('This action cannot be undone.');
  return confirm_form($form, t('Are you sure you want to delete the replacement rule %name?', array(
    '%name' => $rule->name,
  )), "admin/settings/customfilter/{$rule->fid}", $msg_text, t('Delete'));
}