You are here

function access_scheme_delete_confirm in Access Control Kit 7

Form constructor for the access scheme delete confirmation form.

See also

access_scheme_delete_confirm_submit()

1 string reference to 'access_scheme_delete_confirm'
access_menu in ./access.module
Implements hook_menu().

File

./access_schemes.admin.inc, line 479
Access schemes administrative UI for the access control kit module.

Code

function access_scheme_delete_confirm($form, &$form_state, $scheme) {
  $form_state['scheme'] = $scheme;
  $t_args = array(
    '%scheme' => $scheme->name,
  );
  $message = t('Are you sure you want to delete the access scheme %scheme?', $t_args);
  $caption = '';
  $num_grants = db_query('SELECT COUNT(*) FROM {access_grant} WHERE scheme = :scheme', array(
    ':scheme' => $scheme->machine_name,
  ))
    ->fetchField();
  if ($num_grants) {
    $caption .= '<p>' . format_plural($num_grants, 'All access grants within the scheme will also be deleted. %scheme currently contains 1 access grant on your site. If you remove this scheme, the user may not be able to exercise the permissions assigned by that grant.', 'All access grants within the scheme will also be deleted. %scheme currently contains @count access grants on your site. If you remove this scheme, users may not be able to exercise the permissions assigned by those grants.', $t_args) . '</p>';
  }
  $caption .= '<p>' . t('This action cannot be undone.') . '</p>';
  return confirm_form($form, $message, 'admin/structure/access', $caption, t('Delete'));
}