You are here

function tac_fields_delete in Taxonomy Access Control 6

1 string reference to 'tac_fields_delete'
tac_fields_admin in tac_fields/tac_fields.admin.inc
Menu callback for TAC Fields admin page (admin/user/tac_fields).

File

tac_fields/tac_fields.admin.inc, line 201
Administrative interface for TAC Fields.

Code

function tac_fields_delete($form, $field, $rid = NULL) {
  $controlled_fields = _tac_fields_controlled_fields();
  if (in_array($field, $controlled_fields)) {
    if (isset($_POST['confirm'])) {
      if (is_numeric($rid) && $rid > 2) {
        return _tac_fields_disable_role($field, $rid);
      }
      elseif (is_null($rid)) {
        return _tac_fields_disable_field($field);
      }
    }
    else {
      if (is_numeric($rid) && $rid > 2) {
        $message = t("Are you sure you wish to delete all of the %field field's access rules for role %rid?", array(
          '%field' => $field,
          '%rid' => $rid,
        ));
      }
      elseif (is_null($rid)) {
        $message = t("Are you sure you wish to release control of the %field field and delete <strong>all</strong> of its access rules?", array(
          '%field' => $field,
          '%rid' => $rid,
        ));
      }
      else {
        return drupal_not_found();
      }
      return confirm_form($form, $message, 'admin/user/tac_fields', t('This action cannot be undone.'), t('Delete all'), t('Cancel'));
    }
  }
  return drupal_not_found();
}