You are here

function field_validation_delete_rule in Field Validation 7

Confirmation form to delete a rule

2 string references to 'field_validation_delete_rule'
field_validation_callback_dispatch in ./field_validation.admin.inc
Menu callback function using to dispatch.
field_validation_menu in ./field_validation.module
Implements hook_menu().

File

./field_validation.admin.inc, line 281
Manages validation rules administration UI

Code

function field_validation_delete_rule($form, &$form_state, $ruleid) {
  $rule = array();
  if (isset($ruleid) && $ruleid > 0) {
    $rule = field_validation_get_rule($ruleid);
    $form['ruleid'] = array(
      '#type' => 'hidden',
      '#value' => $ruleid,
    );
  }
  if (empty($rule)) {
    $source_path = isset($_GET['destination']) ? $_GET['destination'] : "";
    drupal_goto($source_path);
  }
  return confirm_form($form, t('Are you sure you want to delete the rule %name?', array(
    '%name' => $rule['rulename'],
  )), isset($_GET['destination']) ? $_GET['destination'] : $_GET['q'], t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}